How to Declare the Language of Your Website via HTML?All
Aside other options and internal codes, you should also switch your focus on Language. Curious why it should be among your website settings priorities and how to declare your language? Let’s start with the basics.
Why You Should Declare the Language of Your Website
First off, assuming you have already bought a domain and a hosting service pack for 1+ years, the next step is to decide in which language your website is going to be. For local domain extensions, you should focus on your local language, which is also healthy for the search engine optimization of your page. For international, you should use a language that is spoken frequently: English. You would want to focus on a specific language for
targeting reasons, for traffic, business exposure or personal.
How to Declare the Language via HTML
While users can understand what language is primary on your website with just one click, search engines function based on algorithms and data. Therefore you would need to “speak its own language” and that is HTML. To assist search engines and browsers, the lang (language) attribute can be used to declare the language of a web page or a portion of a web page. For example, the following sets the default language to English:
In XHTML, use both the lang attribute and the xml:lang attribute together every time you want to set the language. Make sure that the values for both attributes are identical.
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
Use Language Codes from ISO 639-1.
We hope you found this useful. Check back for more short tutorials for a better web experience!