Language and regional URL set up

Many websites serve users all around the world with content translated or targeted to users in a certain region. Google uses the rel="alternate" hreflang="x" attributes to serve the correct language or regional URL in the search results. The hreflang attribute enables a search engine to understand the language and geographical set up of a website.

There are 3 scenarios that can be covered with the hreflang attribute:

  1. Same country, different languages.
  2. Different countries, different languages.
  3. Different countries, same language.

If the hreflang attribute is not applied or is applied incorrectly it will mean your target audience will be landing on a page not targeted for them. If you want to improve your visibility in the search engine listing, volume of traffic and bounce rate then use the hreflang attribute carefully.

How to use the hreflang attribute?

The hreflang attribute can be implemented in three ways:

  1. HTML head – using header link elements, a developer can add code to the <head> section of every page.
    hreflang- using header link elements, a developer can add code to the <head> section of every page.
    For dynamic page templates in WordPress, see image , example
  2. HTTP header – the solution for all your PDFs and other non-HTML content you might want to optimize. Link elements work nicely for HTML documents, but not for other types of content as you can’t include them. That’s where HTTP headers come in. They should look like this.
    the solution for all your PDFs and other non-HTML content you might want to optimize.
  3. XML sitemaps – using XML sitemap markup. It uses the xhtml:link attribute in XML sitemaps to add the annotation to every URL. It works very much in the same way as you would in a page’s <head> with <link> elements. If you thought link elements were verbose, the XML sitemap implementation is even worse. This is the markup needed for just one URL with two other languages.
    using XML sitemap markup. It uses the xhtml:link attribute in XML sitemaps to add the annotation to every URL.

Supported languages and region codes

The value of the hreflang attribute defines the language of alternate URLs. For language codes use the ‘ISO 639-1‘ standard, for country codes use the ‘ISO 3166-1‘ standard.

If your site only targets different languages, you only need ISO 639-1. If you need distinction between region and language, then you also need ISO 3166-1.

Examples:

  • en: English content, not restricted to on any specific region
  • en-US: English content, targeted at the US market
  • en-MX: English content, targeted at the Mexican market
More
Addresses
Contact Us
Intouch
newsletter
© 2024 Imarketingonly All rights reserved.

Imarketingonly

The Great Oast, Steep Marsh Petersfield Hampshire GU32 2BN
125/5A Srisoonthorn Road. Cherngtalay District. Thalang Phuket 83110
+66 (0) 76 324184 +66(0) 898 740 040 +44 (0) 1730 895648 +44 (0) 208 1234 164 +44 (0) 7798 554540 Start Price 120 GBP