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

前端 未结 4 1239
囚心锁ツ
囚心锁ツ 2020-12-29 16:00

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. AM

4条回答
  •  执笔经年
    2020-12-29 16:12

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

    https://cdn.ampproject.org/c/s//
    

    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//
    

    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:

    
    

    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

提交回复
热议问题