Link relation type for linking representations to the abstract resource?

旧街凉风 提交于 2019-12-13 00:31:51

问题


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/htmlhttp://example.com/essay.html
  • application/xhtml+xmlhttp://example.com/essay.xhtml
  • application/pdfhttp://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 the type 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

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