-1

I made the static portion of a mobile website amp-compliant, but I'm unsure if there are any further steps necessary in addition to that.

In particular, is it ok (or perhaps even necessary?) to force users to load the pages over Google's CDN, by rewriting website-internal links to the CDN URL of the page? i.e. something like <a href="http_s_://cdn.ampproject.org/c/s/example.net/b.html">...</a>? Or will that somehow mess up Google's Crawler?

In fact, I already tried it briefly, but the pages keep opening in new tabs when clicking the links, even if the current page was loaded over its CDN URL. Is that intentional? I tried using target="_top", but apparently that is disallowed for compliant amp-html.

So what is the recommended solution here?

BVN
  • 21
  • 3
  • Based from this [link](http://stackoverflow.com/a/34757325/5832311), to use the AMP project CDN, you can access via URL of the form: `https://cdn.ampproject.org/c/s//`. Be noted that the `/s` portion is optional and signals a secure origin, so if the origin isn't served over https, then you would use:`https://cdn.ampproject.org/c//`. Sample URL that has an AMP equivalent: `https://cdn.ampproject.org/c/s/amp.theguardian.com/childrens-books-site/2016/jan/12/sugar-tax-andy-mulligan-liquidator` – abielita Oct 06 '16 at 11:01

1 Answers1

1

It certainly isn't necessary to link to the AMP Cache's copy of your pages. If you want to, you can, and in theory the CDN links should work indefinitely. Per the AMP Cache Guidelines, an AMP Cache:

  • Pledges to maintain URL space forever (even beyond the lifetime of the cache itself):
    • This can be achieved by donating the URL space to a trustworthy third party entity such as archive.org.
    • This means that, should a cache decide to no longer operate, URLs should redirect to the origin URL or be served by another cache.

I chose to make my AMP pages link directly to my own copies of my other AMP pages, though, because I had a minor issue with the Google AMP Cache failing to serve some of my images and wanted to make sure that I'd be able to quickly fix things if my pages were improperly served by the cache due to other bugs or validation problems. Ultimately, it's your call whether to link to your canonical non-AMP pages, your AMP pages, or the cache's copies of your AMP pages.

See also this amphtml feature request requesting the ability to ask the AMP cache to rewrite links to point to either CDN or non-CDN versions of pages when possible. Speculating more wildly, I could imagine browsers someday offering to do this rewriting automatically as you browse. I haven't tried it, but there appears to already be at least one Chrome extension that loads AMP versions of pages when they're available.

derat
  • 181
  • 2
  • 11