问题
I use Content negotiation to let user-agents select one of several representations for a resource.
Example: the resource http://example.com/essay
has the following representations:
text/html
→http://example.com/essay.html
application/xhtml+xml
→http://example.com/essay.xhtml
application/pdf
→http://example.com/essay.pdf
Let’s say the user-agent selects the HTML variant. Now I could link the other representations with the link relation type alternate:
<link rel="alternate" type="application/xhtml+xml" href="/essay.xhtml">
<link rel="alternate" type="application/pdf" href="/essay.pdf">
But when someone only has the URI http://example.com/essay.html
, how would he ever know that the content-type neutral URI is http://example.com/essay
, e.g. for sending someone the link without enforcing that he’d want to see the HTML variant, too?
Is there a link type to link back to the "abstract" resource (http://example.com/essay
)?
I can’t use the alternate link relation type for that link too, as the resource has no content type:
If the
alternate
keyword is used with thetype
attribute, it indicates that the referenced document is a reformulation of the current document in the specified format.
I don’t think that the canonical link relation type is appropriate here. It would work in some cases, but maybe I want the HTML variant to be the canonical one (for indexing by search engines etc.). When I’d make http://example.com/essay
the canonical one, search engines could (in principle) use the PDF variant for indexing.
来源:https://stackoverflow.com/questions/16443030/link-relation-type-for-linking-representations-to-the-abstract-resource