3 Easy Steps For Adding The “lang” Attribute in The Blogger Template

The lang attribute is a part of the HTML5 specification. It tells the browser or other user agents (like search engines) to use the specified language settings for the website page. This attribute takes one of the language codes as its value.

This short article will show you the easiest way to add the “lang” attribute to the Blogger template.

How to add lang attribute in blogger template

Here, you will learn the “lang” attribute, why you should use this in your blogger template, and the SEO benefits.

So, let’s get started.

What is the “lang” attribute in HTML?

The lang attribute is used to specify the natural language of the contents in a webpage.

Search engines use search engines to show language-specific results and also helps readers switch language profiles for correct accent and pronunciation.

The syntax looks like this. 

<element lang="language_code">

Here the language_code defines the value of ISO Language Codes. Some common examples are "en" for English, "es" for Spanish, "fr" for French, and so on.

You can also use country codes as an addition to the language code in the lang attribute.

<html lang="en-US">
...
</html>
Here the first two character defines language code, and the last two characters represent country code. 

You can check the complete list of country codes here.

How can I add the “lang” attribute in Blogger?

You can declare language attribute (lang) in blogger in the below format. 

As most blogger templates are written in XHTML format, you can declare a lang attribute like this, as shown in the example below. 

Step-1: Go to your Blogger dashboard and click on the theme section.

Step-2: Here, click on Edit HTML and add the language code highlighted below in your theme code. 

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
...
</html>
Large Lang Atributes in blogger template demo

Step-3: You can also add country code in the above code like lang="en-US" xml:lang="en-US". (optional)

Now save your theme, and the language attribute is added to your blogger website. 

SEO benefits of Language attribute in Blogger

The “lang” attribute may not help you increase traffic, but it does help search engines to serve the right content to the right audience.

It helps help search engines swap the correct version of the page into the SERP (search engine results page) based on a user's location and language preferences.

It is also beneficial for websites that are using multiple languages simultaneously and targeting multi-language audiences.

Here note that you can place the lang attribute to any of the HTML elements like paragraphs(p), headings(h1,h2,h3), etc. But, instead of adding this to all elements, you can declare this in the HTML tag of the page.

Final Words

I hope that by now, you have a clearer idea of what the lang attribute is, how it works, and how to use it on the Blogger template.

If you have any doubts regarding this, feel free to ask me in the comment section. I would love to hear from you.