The hreflang attribute (also referred to as
rel="alternate" hreflang="x") tells Google which language you are using on a specific page, so the search engine can serve that result to users searching in that language.
<link rel="alternate" href="http://example.com" hreflang="en-us" />
Where the Hreflang Attribute Goes
The hreflang attribute can be placed in the on-page markup, the HTTP header, or the sitemap. Only use one of those locations. If you choose the sitemap, this tool can help you.
What the Hreflang Attribute Looks Like
The hreflang attribute on each page should include a reference to itself as well as to all the pages that serve as alternates for it. If your Spanish website sells Iberian ham to customers in Spain, France, and Portugal only, the hreflang attributes for your homepage might look like this:
<link rel="alternate" href="example.com" hreflang="es-es" /> <link rel="alternate" href="example.com/fr/" hreflang="fr-fr" /> <link rel="alternate" href="example.com/pt/" hreflang="pt-pt" />
Google supports the ISO 639-1 format for language codes, and you can get more specific by using the ISO 3166-1 Alpha 2 format to signal which region you're targeting. Not all of the codes are intuitive (for example, the code for the UK is "gb" not "uk"), so double check before pasting the wrong code all over your site. This hreflang tag generator can help.
You can use multiple hreflangs on one page if you want to show that the page is for users in more than one country or area. For example, if the page targets people who speak Amharic in both Ethiopia and Eritrea, you can indicate that like this:
<link rel="alternate" href="example.com" hreflang="am-et" /> <link rel="alternate" href="example.com" hreflang="am-er" />
Don't forget to include a general hreflang attribute without the region code to catch Amharic speaking searchers in Djibouti or other areas of the world that you want traffic from:
<link rel="alternate" href="example.com" hreflang="am" />
Hreflang's Effect on Rankings
Hreflang attributes may not help you increase traffic; instead, the goal of using them is to serve the right content to the right users. They help search engines swap the correct version of the page into the SERP based on a user's location and language preferences. For information on how geotargeting can help with rankings.
Hope this helping.
Don't go violating other's copyright by using their articles in your forum posts. It is no different then copy and pasting into an article on your own website. Refer to Moz for the original source above.
You will need to edit your theme in order to use hreflang tags. Don't use Google Tag Manager. See the hreflang part of my SEO guide for a code base to work with.