hreflang应该如何构建? [英] How the hreflang is supposed to be built?
问题描述
我的问题是
< link rel =alternatehref =http://example.com / enhreflang =en>
< link rel =alternatehref =http://example.com/ithreflang =it>
应该像上面的所有页面一样,或者应该用每个页面的实际url更改:
< link rel =alternatehref =http://example.com/en/<?=$current ;?>中的hreflang = EN >
HTML5 定义:
如果
替代
关键字与hreflang
属性,并且该属性的值与根元素的语言不同,它表示所引用的文档是翻译。
翻译文档(即网页),而不是网站。 http://example.com/it
,
http://example.com / en / hello
链接至 http://example.com/it/ciao
。
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">
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
.
这篇关于hreflang应该如何构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!