Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the amphtml link tag use relative href instead of absolute?

Tags:

amp-html

Our cms hosts multiple domains and generally its much easier to use relative paths whenever possible. I'm just wondering if its ok to have something like: <link rel="amphtml" href="/path/to.amp.html" /> instead of an absolute http(s) url

like image 461
AnothrNmbr Avatar asked Aug 03 '16 18:08

AnothrNmbr


1 Answers

Even if it happens to work, it is much better to use absolute links for this purpose because the document could appear in another context (e.g. a proxy) and then resolving the relative link could fail.

The example provided in the spec is absolute: https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#amp-document-discovery

like image 177
Johannes Avatar answered Oct 13 '22 23:10

Johannes