Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I test the CDN of Google's AMP Project?

Quoted from here: https://www.ampproject.org/docs/get_started/about-amp.html

AMP is a way to build web pages for static content that render fast. AMP in action consists of three different parts:

  • AMP HTML
  • AMP JS
  • AMP CDN

AMP HTML is HTML with some restrictions for reliable performance and some extensions for building rich content beyond basic HTML. The AMP JS library ensures the fast rendering of AMP HTML pages. The AMP CDN (optionally) delivers the AMP HTML pages.

Quoted from here: https://www.ampproject.org/how-it-works/

Google is offering a service that delivers AMP HTML documents given their URL through its CDN.

Where can I find this CDN service, so I can test it? I googled a lot, but I couldn't find any information.

like image 849
Killy Avatar asked Jan 11 '16 11:01

Killy


1 Answers

To use the AMP project CDN, you can access via a URL of the form:

https://cdn.ampproject.org/c/s/<origin-domain>/<path>

Note 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/<origin-domain>/<path>

So, if we take the following URL that has an AMP equivalent: http://www.theguardian.com/childrens-books-site/2016/jan/12/sugar-tax-andy-mulligan-liquidator, looking at the source, we see the following link:

<link rel="amphtml" href="https://amp.theguardian.com/childrens-books-site/2016/jan/12/sugar-tax-andy-mulligan-liquidator">

So, we can form a CDN URL for that AMP document as:

https://cdn.ampproject.org/c/s/amp.theguardian.com/childrens-books-site/2016/jan/12/sugar-tax-andy-mulligan-liquidator

Source: https://github.com/ampproject/amphtml/blob/master/src/service/cid-impl.js#L201

like image 88
Seth Yates Avatar answered Sep 17 '22 16:09

Seth Yates