google-cdn - 如何测试 Google AMP 项目的 CDN?

标签 google-cdn amp-html

引自此处: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.



引自此处:https://www.ampproject.org/how-it-works/

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



我在哪里可以找到这个 CDN 服务,以便我可以测试它?我用谷歌搜索了很多,但找不到任何信息。

最佳答案

要使用 AMP 项目 CDN,您可以通过以下形式的 URL 访问:

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

请注意 /s部分是可选的并表示安全来源,因此如果来源不是通过 https 提供的,那么您将使用:
https://cdn.ampproject.org/c/<origin-domain>/<path>

因此,如果我们采用以下具有 AMP 等效项的 URL:http://www.theguardian.com/childrens-books-site/2016/jan/12/sugar-tax-andy-mulligan-liquidator ,查看源码,我们看到如下链接:
<link rel="amphtml" href="https://amp.theguardian.com/childrens-books-site/2016/jan/12/sugar-tax-andy-mulligan-liquidator">

因此,我们可以为该 AMP 文档形成一个 CDN URL:
https://cdn.ampproject.org/c/s/amp.theguardian.com/childrens-books-site/2016/jan/12/sugar-tax-andy-mulligan-liquidator

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

关于google-cdn - 如何测试 Google AMP 项目的 CDN?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34720444/

相关文章:

css - jQuery UI 无主题 CSS cdn

amp-html - 实验 'amp-script' 抛出错误 : Experiment "amp-script" not enabled.“

adsense - 我可以将 Google Adsense For Search (AFS) 广告单元与 AMP 一起使用吗?

google-signin - 这两个 Google JS 客户端 CDN 有什么区别?

javascript - jquery ui - 如何使用谷歌 CDN

jquery - 在外部托管的 css(特别是 Google CDN jquery-ui.css)中覆盖/删除某些属性的最佳方法是什么?

seo - AMP 错误 : Missing supported structured data element

jquery-mobile - 谷歌 CDN jQuery 移动

amp-html - 有条件地隐藏或显示输入 - AMP

wordpress - 将/?amp=1 重定向到正常 url 的 Apache 或 WordPress 插件