HTTP response headers: multiple Link values

半城伤御伤魂 提交于 2019-12-07 02:05:35

问题


I'm working on SEO for a Rails App.

The website is fully localized, and I'm following this google article to add hreflang alternate links to the pages.

The HTML links in the <head> are ok.

I'm having some troubles with the response headers.

I understand that I'm supposed to provide values for each alternative version of the page, but I'm not sure about how to set multiple values.

I tried to pass them as a comma separated list. Browsers seem to receive it correctly, but since individual values contain semi-colons it looks wrong.

Is there any reference on it? Even an example webpage that is known to implement it correctly would help.


回答1:


I have no experience with this, but according to the examples in the same RFC they get separated by comma:

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

It’s indirectly confirmed by 5.3 (emphasis mine):

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).



来源:https://stackoverflow.com/questions/25369191/http-response-headers-multiple-link-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!