4

Im not sure on handle the canonical link and the alternate tag correctly.

Example: One product "tshirt" with multiple versions (blue, red)

Version blue: DE URL: ..de/kleidung/tshirt-de-blue

<link rel="canonical" href="...de/kleidung/tshirt-de"> <rel="alternate" hreflang="de" href="...de/kleidung/tshirt-de-blue"> <rel="alternate" hreflang="en" href="...de/en/fashion/tshirt-en-blue">

EN URL: ...de/en/fashion/tshirt-en-blue

<link rel="canonical" href="...de/en/fashion/tshirt-en"> <rel="alternate" hreflang="de" href="...de/kleidung/tshirt-de-blue"> <rel="alternate" hreflang="en" href="...de/en/fashion/tshirt-en-blue">

Version red: DE URL: ..de/kleidung/tshirt-red

<link rel="canonical" href="...de/kleidung/tshirt-de"> <rel="alternate" hreflang="de" href="...de/kleidung/tshirt-de-red"> <rel="alternate" hreflang="en" href="...de/en/fashion/tshirt-en-red">

EN URL: ...de/en/fashion/tshirt-red

<link rel="canonical" href="...de/en/fashion/tshirt-en"> <rel="alternate" hreflang="de" href="...de/kleidung/tshirt-de-red"> <rel="alternate" hreflang="en" href="...de/en/fashion/tshirt-en-red">

There is a general url for the product

Version general: DE URL: ..de/kleidung/tshirt-de

<link rel="canonical" href="...de/kleidung/tshirt-de"> <rel="alternate" hreflang="de" href="...de/kleidung/tshirt-de"> <rel="alternate" hreflang="en" href="...de/en/fashion/tshirt-en">

EN URL: ..de/en/fashion/tshirt-en

<link rel="canonical" href="...de/en/fashion/tshirt-en"> <rel="alternate" hreflang="de" href="...de/kleidung/tshirt-de"> <rel="alternate" hreflang="en" href="...de/en/fashion/tshirt-en">

So the canonical for each version and language is set the canonical to general language url and set alternate tags to the other language of the specific version.

The general version set canonical to itself and add the alternate tag to the other language from general version.

Is this the correct way ? Should i remove the altenate from the specific versions ? Should the canonical from each language set to the same (default) language ?

3

Hey @WarrenH and @Maximillian Laumeister,

thx for your answers. I found this website: https://www.searchviu.com/en/hreflang-canonical/

and if i understand it. The solution is:

Version blue:

DE URL: ..de/kleidung/tshirt-de-blue

<link rel="canonical" href="...de/kleidung/tshirt-de">

EN URL: ...de/en/fashion/tshirt-en-blue

<link rel="canonical" href="...de/en/fashion/tshirt-en">

Version red: DE URL: ..de/kleidung/tshirt-red

<link rel="canonical" href="...de/kleidung/tshirt-de">

EN URL: ...de/en/fashion/tshirt-red

<link rel="canonical" href="...de/en/fashion/tshirt-en">

There is a general url for the product

Version general:

DE URL: ..de/kleidung/tshirt-de

<link rel="canonical" href="...de/kleidung/tshirt-de">
<rel="alternate" hreflang="de" href="...de/kleidung/tshirt-de">
<rel="alternate" hreflang="en" href="...de/en/fashion/tshirt-en">

EN URL: ..de/en/fashion/tshirt-en

<link rel="canonical" href="...de/en/fashion/tshirt-en">
<rel="alternate" hreflang="de" href="...de/kleidung/tshirt-de">
<rel="alternate" hreflang="en" href="...de/en/fashion/tshirt-en">
  • This setup will advise search engines to only index the general product pages. Does the "version general" include all colors? If so, this'll work fine. Also, Google's recommendations in case you're curious: Canonicals: English | German. Hreflangs: English | German – Warren Halderman Feb 13 at 9:19
  • The general and the versions(blue/red) contain a dropdown to change content to selected version. At each version url, the version is preselected in the dropdown. At the general page there is the first value preselected – CodeRocker Feb 13 at 9:33
  • 1
    In that case this setup should work fine. – Warren Halderman Feb 13 at 9:46
2

Edit: I am not entirely sure that this answer is correct, as pointed out by WarrenH in the comments. However I am leaving it up because it (and Warren's comments) have some potentially useful info.

The rel=alternate tag is used for specifying different representations of the same page, and the hreflang attribute is more specifically for specifying a different (human) language representation. You especially wouldn't want to use the hreflang attribute to specify product variations, it's for languages only.

Read more about the rel=alternate attribute here:

http://microformats.org/wiki/rel-alternate

The rel=alternate attribute is a relatively versatile attribute - you can use it to specify different language versions, mobile vs desktop versions, and human vs machine-readable versions of the same content.

As an example I think you want to take your current code:

<link rel="canonical" href="...de/kleidung/tshirt-de">
<rel="alternate" hreflang="de" href="...de/kleidung/tshirt-de-blue">
<rel="alternate" hreflang="en" href="...de/en/fashion/tshirt-en-blue">

and change it to this:

<link rel="canonical" href="...de/kleidung/tshirt-de">
<rel="alternate" hreflang="de" href="...de/kleidung/tshirt-de">
<rel="alternate" hreflang="en" href="...de/en/fashion/tshirt-en">

This specifies the alternate language representation of the canonical page.

It might be possible to specify a different product version by using the alternate tag but with no hreflang, but I am not sure if there is a standard for doing that. Your site will be fine without it.

  • Each language version must list itself as well as all other language versions. CodeRocker is implementing this correctly according to Google's Guidelines. – Warren Halderman Feb 13 at 2:48
  • @WarrenH Thank you, I was mistaken about the requirement of listing the current language. However that doesn't mean CodeRocker's implementation is correct. It still needs to be changed to reference the other canonical URLs. – Maximillian Laumeister Feb 13 at 2:51
  • Can you elaborate? The canonicals are correct as well. Each translated version should canonical to itself. Translated content is not duplicate content, which is why the hreflangs are used. Unless the content isn't actually translated... then we've got a separate issue ;) – Warren Halderman Feb 13 at 3:02
  • Update: I failed to notice the color/colorless mix up, my apologies. In this case, we don't know if most of the content is equivalent across each color-specified product page. If it is, the canonicals are used correctly. If not, some changes need to be made. – Warren Halderman Feb 13 at 3:18
  • @WarrenH I think you still may be right. The question comes down to: "When you specify a rel=alternate page, does that URL need to be the canonical version of the URL?" Unfortunately I can't find any good answers on the internet by doing a cursory search, but I bet an answer is out there. – Maximillian Laumeister Feb 13 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.