问题
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">
回答1:
HTML5 defines:
If the
alternate
keyword is used with thehreflang
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
.
来源:https://stackoverflow.com/questions/31248004/how-the-hreflang-is-supposed-to-be-built