Alan Reed
Alan Reed

Reputation: 503

How to structure hreflang tags with default language page

I have multiple translations of each page on my site. Example:

  1. https://www.example.com/something (English - default)
  2. https://www.example.com/en/something (English)
  3. https://www.example.com/es/something (Spanish)

I am trying to figure out the correct hreflang tags for these pages. None of Google's examples seem to explain how to handle it when you have 2 pages for the language. One is just the canonical.

If I do this, ahrefs tells me I have an error because there are 2 pages for "en":

<link rel="alternate" hreflang="en" href="https://www.example.com/something" />
<link rel="alternate" hreflang="en" href="https://www.example.com/en/something" />
<link rel="alternate" hreflang="es" href="https://www.example.com/es/something" />

Google actually discourages using canonical tags along with hreflang tags. https://developers.google.com/search/blog/2011/12/new-markup-for-multilingual-content

Is the correct solution to simply not have the "/en" version?

Upvotes: 0

Views: 188

Answers (2)

MilesWeb
MilesWeb

Reputation: 111

In this scenario, you can add a self-referencing hreflang tag for the default language version. This helps Google bots to identify which is the default version of the page. You can use the x-default html attribute for the default language page.:

In the following example, "https://www.example.com/default-page" is the default language page, and there are alternate versions in Spanish and French.

Example :

<link rel="alternate" hreflang="en" href="https://www.example.com/default-page">

<link rel="alternate" hreflang="es" href="https://www.example.com/es/page-url">

<link rel="alternate" hreflang="fr" href="https://www.example.com/fr/page-url">

<link rel="alternate" hreflang="x-default" href="https://www.example.com/default-page">

Upvotes: 0

diegofrancesco
diegofrancesco

Reputation: 32

You don't need the /en/something page because you already have the main English domain with hreflang="en". You would have double and identical pages without a utility, even setting canonical tags. The important thing is that each language has its correct hreflang.

Upvotes: 0

Related Questions