tompave tompave - 11 months ago 48
HTML Question

HTTP response headers: multiple Link values

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

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.

Answer Source

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