The language attribute (lang
attribute) is an important HTML tag that specifies the language of your website’s content. It helps search engines, browsers, and screen readers understand the language used on your website, improving accessibility and SEO. Adding the correct language attribute is especially important if your site targets multilingual audiences. Here’s a step-by-step guide on how to add or update the language attribute using OzSpeed’s hPanel.
Step 1: Access Website Settings in hPanel #
To begin adding the language attribute, open the Website Settings in hPanel.
- Log in to hPanel at ozspeed.com.au.
- Go to Website Settings > General Settings.
Tip: #
- Determine the primary language of your website content before proceeding (e.g., English, Spanish, French).
Step 2: Choose the Default Language #
You can set the default language for your website, which will be reflected in the lang
attribute.
How to Set the Default Language: #
- In General Settings, find the Language option.
- Select the primary language of your website from the dropdown list (e.g., English (en), Spanish (es)).
- Click Save.
Tip: #
- If your website supports multiple languages, choose the primary language that reflects the majority of your content.
Step 3: Add the Language Attribute Manually (Optional) #
If you need more control, you can manually add the lang
attribute to your website’s HTML code.
How to Manually Add the Language Attribute: #
- Go to Website Settings > Custom Code in hPanel.
- Click on the Header Code section.
- Add the following line of code at the top:htmlCopy code
<html lang="en">
Replace"en"
with the appropriate language code for your content (e.g.,"fr"
for French,"de"
for German). - Click Save.
Tip: #
- Use the ISO 639-1 language codes for the
lang
attribute (e.g.,"en"
for English,"es"
for Spanish).
Step 4: Set Language Attributes for Multilingual Pages #
If your website supports multiple languages, set the lang
attribute for each page individually.
How to Set Language Attributes for Multilingual Pages: #
- Open the Page Editor for each language-specific page.
- Go to the SEO & Settings tab.
- In the Language Attribute field, enter the appropriate language code (e.g.,
"fr"
for French,"es"
for Spanish). - Click Save.
Tip: #
- Ensure that each page has the correct
lang
attribute to help search engines index the content properly.
Step 5: Verify the Language Attribute #
After updating the language attribute, verify that it has been correctly applied to your website.
How to Check the Language Attribute: #
- Open your website in a browser.
- Right-click on the page and select View Page Source.
- Look for the
<html lang="en">
tag at the top of the HTML document.
Tip: #
- Use an online tool like W3C Markup Validator to check if the
lang
attribute is correctly implemented.
Step 6: Test Accessibility #
The language attribute helps screen readers correctly pronounce the content. Test your website’s accessibility using screen reader tools.
How to Test Accessibility: #
- Use a screen reader tool like NVDA (Windows) or VoiceOver (Mac).
- Listen to how the content is read aloud and ensure it matches the specified language.
Tip: #
- If your website has multiple languages, check each page to ensure the correct language attribute is set.
Troubleshooting Tips #
- Language Attribute Not Recognized:
- Double-check the syntax of the
lang
attribute in your HTML code. - Ensure the language code follows the ISO 639-1 standard.
- Double-check the syntax of the
- Wrong Language Detected by Search Engines:
- Verify that the
lang
attribute is set correctly for all pages, especially if your site is multilingual. - Submit your updated sitemap to Google Search Console to help search engines detect the language changes.
- Verify that the
- Accessibility Issues:
- Test your website with multiple screen reader tools to ensure the content is read correctly based on the
lang
attribute.
- Test your website with multiple screen reader tools to ensure the content is read correctly based on the
Additional Tips: #
- Specify Regional Variants: For regional language variations, use codes like
"en-US"
for American English or"en-GB"
for British English. - Use Language Switchers: If your site is multilingual, include a language switcher on your pages to help users easily change languages.
- Monitor SEO Impact: Track your website’s performance in Google Search Console to see if the language attribute improves search visibility for the targeted language.