How the hreflang is supposed to be built?
Asked Answered
S

1

0

My question is does the

<link rel="alternate" href="http://example.com/en" hreflang="en">
<link rel="alternate" href="http://example.com/it" hreflang="it">

should be like above an all pages or should be changed with the actual url of every page like:

<link rel="alternate" href="http://example.com/en/<?=$current;?>" hreflang="en">
<link rel="alternate" href="http://example.com/it/<?=$current;?>" hreflang="it">
<link rel="alternate" href="http://example.com/<?=$current;?>" hreflang="x-default">
Slaughterhouse answered 6/7, 2015 at 14:6 Comment(1)
Google read Common mistakes -> Example hreflang configuration: Annotations in action.Owner
U
0

HTML5 defines:

If the alternate keyword is used with the hreflang attribute, and that attribute's value differs from the root element's language, it indicates that the referenced document is a translation.

So it’s for translated documents (i.e., pages), not sites.

http://example.com/en links to http://example.com/it,
http://example.com/en/hello links to http://example.com/it/ciao.

Underthecounter answered 8/7, 2015 at 11:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.