HTML5: should hreflang always point to a direct translation?
Asked Answered
C

2

0

This is a good practice to place this kind of links in head for multilanguage sites:

<head>
    <link rel="alternate" hreflang="en" href="/en">
</head>

But, according to an answer to the question Semantic markup for language switcher, language switcher should look something like:

<nav>
  <h1>Translations of this page</h1> <!-- could be omitted → usability question -->
  <ul>
    <li>English</li> <!-- could be omitted → usability question -->
    <li><a rel="alternate" href="/pl" hreflang="pl" lang="pl">Polski</a></li>
    <li><a rel="alternate" href="/de" hreflang="de" lang="de">Deutsch</a></li>
  </ul>
</nav>

I've got few semantic markup questions according to that:

  1. Are both of those rules required for SEO? Or, if I've got language switcher on my site, links in head are not needed anymore?

  2. Let's say that I'm on the page: example.com/pl/kontakt. Should translation links inside head (or nav) point to: example.com/en/contact (direct translation), or only example.com/en (English mainpage)?

  3. What about more specific situation: example.com/pl/aktualnosci/id/101. 'aktualnosci' means news. As you can see not all the newses can be translated into every language. And it is sometimes hard to predict the perfect translation URL, based on only parameters. So the question is: where should the translation link (or nav) point for this URL: example.com/pl/artykul/id/101, when:

    1. We are not sure if this resource is translated?
    2. We don't exactly know the translation URL?
    3. Resource is for 100% not translated?

I hope my question is clear. But I will put one more example: Someone is on the page example.com/en/news/2015/03/02/stackoverflow-rules, and this news is not translated to Polish. Is it a mistake to put:

<link rel="alternate" hreflang="pl" href="/pl/aktualnosci">

as a translation? Of course this page is not a translation, but only for example a list of all translated newses.

As for me semantically it is a mistake, as this is NOT a translation, but from UX side, it is great, because it points to the nearest translated resource and make life easier for the user.

Canty answered 27/7, 2015 at 11:50 Comment(0)
S
1

alternate+hreflang: link vs. a

Semantically it makes no difference which one to use. In both cases the link links to a translation of the page.

But it’s conceivable that a consumer (e.g., a search engine) decides to ignore alternate+hreflang on a elements, for example because some sites allow this markup in user comments. It’s rare that users could edit the head, so they might only look for alternate+hreflang on link elements in the head.

Unless you have strong reasons not to do this, simply provide both:

  • a language switcher, especially for your human users, in the body (a elements)
  • translations links for bots that only check the head (link elements)

Page vs. site

An alternate+hreflang link is defined to point to a translated document, not a site.

Pages not translated

If /pl/artykul/id/101 is not translated into other languages (or you don’t know for sure that it is, or you don’t know the URL), simply don’t use alternate+hreflang.

And yes, it would be wrong to link to a translated parent page in this case: /pl/aktualnosci is not a translation of /en/news/2015/03/02/stackoverflow-rules.

Of course you could still provide such a link for usability reasons, but you should not use the alternate+hreflang markup for this link.

Saxtuba answered 29/7, 2015 at 11:33 Comment(3)
Thanks for your reply. I undo-ned the first acceptance and accepted Your answer, as it is more subject related, and answer all my doubts. Thanks for your time and links. It is also a great idea to leave the link but ommit the alternate / hreflang attributes. Great idea, great answer, great feedback. BR!Canty
Great, I changed accepted answer to yours, and we both got downvoted... I'm losing my faith in some of stackoverflow users. Stackoverflow should be a great proven knowledge resource, and not: downvote if not my answer rat race forum...Canty
@JacekKowalewski: Yeah, it’s sad, but these are luckily only rare exceptions. After this, Szabolcs Páll even downvoted 8 of my other (totally unrelated) posts, but the system detected it and reversed the votes (only if he repeatedly tries it again, the system might ban his account).Saxtuba
O
1
  1. Since rel attribute defines the relation of the linked document, if you use it in the anchor tag theres no need for the link tag in the header.
  2. The translation link should always point to the translated version of the current page and not the website (pl/kontakt -> en/contact).
  3. If the resource is not translated, omit the link to the translation (obviously you have to check for translations when generating the page). If the URLs are translated then the translation link must point to the URL of the target language (same of above, must check for translations ahead).

As of UX if I'm reading the news of today, when I click on a link promising me to show it in my own language, the last thing I want to find is the news of yesterday translated, instead I would rather understand that there's no translation available (grayed out disabled link might be the most user friendly), before navigating. So better follow semantics and keep it simple, instead of trying to present a counter-intuitive UX.

Offshoot answered 27/7, 2015 at 13:39 Comment(2)
Thanks for the answer, I find it really useful. Can You link some specifications on point 1? I believe You however I was searching for the answer, and didn't find anything. +1 from me. I will wait a while for another answers (maybe someone is writing an encyclopedia :P), and if none, I will of course accept yours.Canty
w3.org/TR/html5/links.html#rel-alternate for the standards, and also w3.org/TR/WCAG10/#gl-provide-equivalents that is talking about how differently abled people need the same information in different format (apply it to usability and languages and you'll see my point).Offshoot
S
1

alternate+hreflang: link vs. a

Semantically it makes no difference which one to use. In both cases the link links to a translation of the page.

But it’s conceivable that a consumer (e.g., a search engine) decides to ignore alternate+hreflang on a elements, for example because some sites allow this markup in user comments. It’s rare that users could edit the head, so they might only look for alternate+hreflang on link elements in the head.

Unless you have strong reasons not to do this, simply provide both:

  • a language switcher, especially for your human users, in the body (a elements)
  • translations links for bots that only check the head (link elements)

Page vs. site

An alternate+hreflang link is defined to point to a translated document, not a site.

Pages not translated

If /pl/artykul/id/101 is not translated into other languages (or you don’t know for sure that it is, or you don’t know the URL), simply don’t use alternate+hreflang.

And yes, it would be wrong to link to a translated parent page in this case: /pl/aktualnosci is not a translation of /en/news/2015/03/02/stackoverflow-rules.

Of course you could still provide such a link for usability reasons, but you should not use the alternate+hreflang markup for this link.

Saxtuba answered 29/7, 2015 at 11:33 Comment(3)
Thanks for your reply. I undo-ned the first acceptance and accepted Your answer, as it is more subject related, and answer all my doubts. Thanks for your time and links. It is also a great idea to leave the link but ommit the alternate / hreflang attributes. Great idea, great answer, great feedback. BR!Canty
Great, I changed accepted answer to yours, and we both got downvoted... I'm losing my faith in some of stackoverflow users. Stackoverflow should be a great proven knowledge resource, and not: downvote if not my answer rat race forum...Canty
@JacekKowalewski: Yeah, it’s sad, but these are luckily only rare exceptions. After this, Szabolcs Páll even downvoted 8 of my other (totally unrelated) posts, but the system detected it and reversed the votes (only if he repeatedly tries it again, the system might ban his account).Saxtuba

© 2022 - 2024 — McMap. All rights reserved.