html - HTTP 响应 header : multiple Link values

标签 html seo http-headers

我正在为 Rails 应用程序进行 SEO。

该网站已完全本地化,我正在关注 this google article向页面添加 hreflang 备用链接。

<head> 中的 HTML 链接没问题。

我在使用 response headers 时遇到了一些问题.

我知道我应该为页面的每个替代版本提供值,但我不确定如何设置多个值。

我尝试将它们作为逗号分隔列表 传递。浏览器似乎正确接收了它,但由于各个值包含分号,所以看起来错误

有引用资料吗? 即使是已知可以正确实现它的示例网页也会有所帮助。

最佳答案

我没有这方面的经验,但根据 examples在同一个 RFC 中,它们用逗号分隔:

Link: </TheBook/chapter2>;
      rel="previous"; title*=UTF-8'de'letztes%20Kapitel,
      </TheBook/chapter4>;
      rel="next"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel

5.3间接证实(强调我的):

Note that extension relation types are REQUIRED to be absolute URIs in Link headers, and MUST be quoted if they contain a semicolon (";") or comma (",") (as these characters are used as delimiters in the header itself).

关于html - HTTP 响应 header : multiple Link values,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25369191/

相关文章:

jquery - 我如何让这个滚动只移动容器 div 而不是整个 body

javascript - setTimeout 我做错了吗?用于烟花

javascript - 如果单击单选按钮,如何使不可见的文本框可见?

asp.net - 建立多语言网站

.htaccess - 使用正则表达式的 htaccess 301 重定向

php - 使用 HTTP header 和 curl 查找 URL 重定向?

python - 为什么我不能只添加 Content-Type :text/html to a text file when Python can?

javascript - 在 anchor 标记中指定 HTTP header

javascript - 当行在 View 之外时,如何获得可滚动的 div 元素来滚动已设置为通过箭头键选择的行?

c# - 将 URL 页面扩展名(.aspx)转换为 HTML(.html)