Add HTML code for alternate language versions of pages
I noticed that Google now indexes (at least some of the) alternative language versions of the P&C homepage. That’s great! And it led me to investigate how Google manages multi-lingual websites in general. It is detailed on these pages:
https://developers.google.com/search/docs/advanced/crawling/managing-multi-regional-sites https://developers.google.com/search/docs/advanced/crawling/localized-versions
The TDLR version is that to make Google properly understand and handle the different language versions of a page, you just need to add special ‘link’ elements in the <head>
element in the HTML code. For https://www.peppercarrot.com/en/webcomics/, it should look something like this:
<head>
<title><title>Webcomics - Pepper&Carrot</title></title>
<link rel="alternate" hreflang="es-MX"
href="https://www.peppercarrot.com/mx/webcomics/" />
<link rel="alternate" hreflang="nn"
href="https://www.peppercarrot.com/nn/webcomics/" />
…
<link rel="alternate" hreflang="en-US"
href="https://www.peppercarrot.com/en/webcomics/" />
<link rel="alternate" hreflang="x-default"
href="https://www.peppercarrot.com/en/webcomics/" />
</head>
Note that a link for the current language (here en-US
) also needs to be listed (all language versions should link to each other). So basically, the above list of links should be identical on all versions of the page. The last link, with language x-default
is a fallback meant to match any other languages, and should use the same URL as the en-US
version.
I think the idea is that Google will automatically show the appropriate language version of a page in the search results. (And perhaps a page will also get a higher ranking if it’s available in the user’s language?)