Hreflang Attributes & Tags Explained for Beginners

Jan 29, 2025 | SEO News Feeds | 0 comments

Hreflang Attributes Tags Explained For Beginners.png



SEO Content Writing Service

Learn about the role hreflang attributes play in helping multilingual and multiregional websites show the correct language versions to users.

What Is Hreflang?

Hreflang is an HTML attribute that communicates a webpage’s language—and possibly its target country—to search engines when the page has language or country variants.

For example, the hreflang attribute hreflang=”en-us” signals that the specified page is written in English and targeted to U.S. audiences.

If you have multiple versions of your pages to serve different languages or countries, you should use hreflang in your search engine optimization (SEO) strategy. 

Why Are Hreflang Attributes Important for SEO?

Hreflang attributes are important for SEO because they help ensure search engines display the correct versions of your pages based on users’ languages and locations.

Like this:

When Google displays the most relevant page version, users are more likely to click your result, have a good experience on your website, and contribute to your business goals.

Hreflang attributes also help search engines find and understand relationships between localized pages.

Without hreflang, search engines may view translated or regionalized pages as duplicate pages. And this can harm your search visibility.

If you haven’t created pages for different languages or regions yet, read our website localization guide to learn about the benefits. 

Attorney Websites For Sale 4ebusiness Media Group

How to Implement Hreflang

To implement hreflang, identify a set of pages on your site that share the same content but for different languages or countries. Then assign each page a different identifier, depending on its targeting.

The anatomy of hreflang code is hreflang=”value”, where value is filled in based on one of the following:

  • Language code: The two-letter ISO 639-1 language code for the page’s language. For example, en for English. You should use this option if the page serves as a default for all speakers of the language.
  • Language and country code: The ISO 639-1 language code and ISO 3166-1 alpha-2 country code for the target language/country, separated by a hyphen (-). For example, en-us for English-United States. The country code is only required if your page is region-specific and doesn’t serve as a default for all speakers of the language.
  • X-default: Use the x-default value for the main version of your page. Search engines will display the default if no variant matches the user’s language or language-region.

Finally, follow one or more of the hreflang implementation methods below.

Check your website platform for features or plugins that make hreflang implementation and management easier. If you’re unsure about anything, get help from a web developer. 

You can use hreflang tags in pages’ HTML header elements (<head> sections) to inform search engines about the language/region targeting of a page and its variants.

An hreflang tag specifies a URL and its hreflang attribute, like this:

<link rel=”alternate” href=”url” hreflang=”value” />

Every affected page should have an hreflang tag that references the source page and its variants.

For example, the tag highlighted below shows that the source page is written in German for audiences in Germany (de-de). 

The other hreflang tags show that the page is also available in English for audiences in Ireland (en-ie), French for audiences in Guinea (fr-gn), etc.

Hreflang tag is shown in the code with list of other hreflang tags for that page.

These same hreflang tags are used on all other versions of the page as well.

For example, here’s a snippet of HTML from the English version for audiences in Ireland:

In the source code, the hreflang attribute shows the Ireland URL and the hreflang value en-ie.

Hreflang in the XML Sitemap

You can use hreflang in your website’s XML sitemap to inform search engines about language and region targeting across your website.

The XML sitemap is a file that should list all the URLs you want search engines to index (add to the database of possible search results).

Here’s what you need to do for pages with language/region variants:

  • Include a <url><loc> entry for every URL variant
  • Within each <url> element, use the <xhtml:link> element to provide the hreflang information for the specified URL and its variants

For example, if you have two versions of a page, the corresponding XML code should look something like this:

<url>
<loc>https://www.example.com/</loc>
<xhtml:link rel=”alternate” href=”https://www.example.com/” hreflang=”x-default” />
<xhtml:link rel=”alternate” href=”https://www.example.com/gb/” hreflang=”en-gb” />
</url>
<url>
<loc>https://www.example.com/gb/</loc>
<xhtml:link rel=”alternate” href=”https://www.example.com/” hreflang=”x-default” />
<xhtml:link rel=”alternate” href=”https://www.example.com/gb/” hreflang=”en-gb” />
</url>

Note that both URLs reference themselves and each other.

If you have a non-HTML page (like a PDF), you need to implement hreflang via the HTTP header.

Use this template to tell search engines about the language (and region if you wish) associated with the source page and its variants:

<url1>; rel=”alternate”; hreflang=”value1″, <url2>; rel=”alternate”; hreflang=”value2″ …

For example, you might add this to the HTTP header of all three listed pages:

<https://www.example.com/>; rel=”alternate”; hreflang=”x-default”, <https://www.example.com/us/>; rel=”alternate”; hreflang=”en-us”, <https://www.example.com/gb/>; rel=”alternate”; hreflang=”en-gb” 

Again, note that the variant pages should reference themselves and each other.

Best Practices for Hreflang

Follow these best practices when using hreflang on your website:

Use Canonical URLs in Hreflang Code

You should only use canonical URLs in hreflang code to avoid confusing search engines and harming your SEO performance.

A canonical URL is the main address for a webpage and the URL that search engines use in search results. Search engines ignore any alternate URLs to save resources and prevent duplication.

Let’s say you can access the same page via three addresses:

  • Canonical URL: https://www.example.com/en/ 
  • Alternate URL: https://www.en.example.com/
  • Alternate URL: example.com/en

You should only reference the canonical URL in hreflang code and avoid any alternate URLs.

In practice, this means you should not reference:

Keep Your Hreflang Code Updated

Update your hreflang code if you add, remove, or change URLs that have localized variants to avoid outdated code that can confuse search engines and harm your SEO.

Let’s say you implement hreflang via your XML sitemap for your English and Spanish website. 

If you later translate your site into German, you need to:

  • Add the new URLs (and their hreflang code) to your XML sitemap
  • Update XML entries for existing page variants to ensure they reference the German variants

Audit Your Website for Hreflang Issues

Regularly audit your website for hreflang issues to check for any mistakes that could confuse or mislead search engines—and so harm your SEO.

Semrush’s Site Audit tool can help you find and fix the most common hreflang SEO issues, including:

  • Invalid hreflang values
  • Pages without self-referencing hreflang attributes
  • Pages with missing hreflang attributes
  • References to broken or non-canonical URLs
  • Mismatches between the language code and the page’s language

Search for hreflang in Site Audit shows how many pages have attribute and value issues as well as how to fix them.

The Site Audit tool also helps you find and fix many other kinds of SEO issues. And free users can crawl up to 100 pages per month.

Source link


Anxiety Stress Management

Live a Life of Contentment eBook We all want to be satisfied, even though we know some people who will never be that way, and others who see satisfaction as a foreign emotion that they can’t hope to ever feel.

Newspaper Ads Canyon Crest CA

Click To See Full Page Ads

Click To See Half Page Ads

Click To See Quarter Page Ads

Click To See Business Card Size Ads

If you have questions before you order, give me a call @ 951-235-3518 or email @ canyoncrestnewspaper@gmail.com Like us on Facebook Here

You May Also Like

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Contact Us

Contact Us

Personal Injury Attorney

Websites For Sale Personal Injury Attorneys

Criminal Defense Attorneys

Websites For Sale Criminal Defense Attorney

Bankruptcy Attorneys

Websites For Sale Bankruptcy Attorneys

General Practice Attorneys

Websites For Sale General Practice Attorneys

Family Attorneys

Websites For Sale Family Attorneys

Corporate Attorneys

Websites For Sale Corporate Attorneys

Home Privacy Policy Terms Of Use Anti Spam Policy Contact Us Affiliate Disclosure Amazon Affiliate Disclaimer DMCA Earnings Disclaimer