Opened 4 years ago

Closed 4 years ago

#5108 closed enhancement (fixed)

Hreflang on the homepage

Reported by: bradleyt's profile bradleyt Owned by:
Milestone: Priority: normal
Component: Site Keywords: seo has-patch


On most of the network, the hreflang configuration seems reasonably well setup. However, I have noticed this is not true of the homepage (not Rosetta homepages), where I have spotted various issues:

  • The list of sites do not match those shown in the hreflang of Rosetta sites. e.g.: homepage lists but not
The Rosetta sites list but not

  • The made up "emoji" language is shown on the homepage.
  • The homepage incorrectly uses 3-letter character codes such as "bel" and "dzo". Hreflang languages need to be specified as a 2-digit ISO 639-1 code, with optional region, and on other parts of .org "bel" is mapped to "be-by" and "dzo" to "dz-bt". There are other examples of three letter codes in use, but I've just picked out a couple of examples.

It seems that the hreflang logic is reimplemented for different parts of the .org network (Homepage, Rosetta, themes, plugins). Is there a reason why a central plugin cannot handle hreflang across the network? There are other improvements which could be made to the hreflang setup across the .org sites, but without a consistent implementation any fixes are going to have limited benefit.

Attachments (1)

wordpress-org-hreflang.txt (10.1 KB) - added by bradleyt 4 years ago.
Suggested hreflang mapping for homepage

Download all attachments as: .zip

Change History (7)

#1 @Otto42
4 years ago

The logic is the same in most places across the site, but the homepage is special. It's the most visited page, so it's been made to be static, for performance. Thus, the hreflang listing there is also static. This means that it has not been updated at the same time as the code to generate this listing on the other pages.

All that really needs to be done is to rebuild the list for the homepage and update the static copy of it to match.

#2 @jonoaldersonwp
4 years ago

This is really just the tip of the iceberg - the hreflang behaviour is an absolute nightmare.

If we really want to fix this, it needs to stay in sync, rather than must have a one-off update. Otherwise there's not really much point.

But... That'd require radical changes to how the sites are structured and managed, and, dedicated fixes for the myriad of outlier/static/orphaned pages, across the whole ecosystem. The homepage is really only one tiny piece of the puzzle; there are dozens of sites and thousands of pages and templates where the markup is wrong/stale/conflicting/missing.

To be honest, I'm of half a mind just to accept that it'll never be even close to right, and to just try and ignore it all.

#3 @bradleyt
4 years ago

I've got a lot of sympathy for wanting to ignore the hreflang issues across the site. There are certainly some other big issues that are potentially far harder to tackle (e.g. the hreflang's on almost all point to 404 pages, no doubt wasting crawl budget).

That said, the homepage is the entry-point into the whole ecosystem, and it seems silly not to try and get it as close to correct as is possible. It sounds like getting the homepage to match the setup on the rest of the site would be a reasonably quick job, and doesn't seem to have any downsides - I'd recommend it is done.

#4 @jonoaldersonwp
4 years ago

Agreed, though we still need to tackle the fact that it'll become stale as soon as the array of sites changes at all (which isn't particularly rare).

Can you create a static list of the right values as of now, and dump it here? Let's get that fixed for now!

4 years ago

Suggested hreflang mapping for homepage

#5 @bradleyt
4 years ago

  • Keywords has-patch added

Attached is the hreflang I think we should be using. This matches the hreflang setup on other parts of the site, which should ensure the hreflang directives are correctly respected by Google (& bing etc).

It's worth noting that this new hreflang setup specifies regions for most language codes, which was not the case before (es-es, rather than es). There is an argument for removing the region in cases where there is only one regional variation of a language, or to specify the most complete translation for a language, but if we want to do this then it should be done across all parts of For now consistency across the site is the more important consideration.

#6 @coffee2code
4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [15898-dotorg] on 2020-04-07: Homepage: Update hreflang tags.

Props bradleyt.
Fixes #5108.

The actual commit is of the most current hreflang listing consisting of 166 entries vs the 138 from the time of the attached patch.

Note: See TracTickets for help on using tickets.