由于 ampproject.org 在中国被屏蔽,是否可以为 AMP 使用备用 CDN?
Is it possible to use an alternate CDN for AMP as ampproject.org is blocked in China?
有没有办法使用备用 CDN 来包含 AMP 需要的 JavaScript 主文件?可以使用与 https://cdn.ampproject.org/v0.js
不同的 URL 吗?是否有计划通过允许在中国未被阻止的其他 CDN 等来进一步开放它?
使用网络搜索返回的几个顶级代理,ampproject.org
似乎在中国被屏蔽了。这并不奇怪,因为其他 Google 属性已被阻止。
编辑:我应该提到我尝试复制文件并 运行 在本地,但是 AMP 验证程序在我尝试时抛出错误。
不幸的是,我认为主要 Javascript AMP 需要的源文件只能使用 https://cdn.ampproject.org
URL.
根据博客“Getting started with AMP Html, accelerated mobile pages”
AMP does this by creating new rules for bottlenecks: JavaScript and html elements that are considered slow are prohibited. JavaScript is only allowed using libraries provided by the CDN of Google itself.
也在他们的官方网页上:
Our goal with AMP HTML is reliable performance, so we designed it to be easily cacheable by content delivery networks (CDNs). Google is offering a service that delivers AMP HTML documents given their URL through its CDN. Others can use this service or make their own or serve AMP HTML pages from a plain-old-web-server.
JS应该不会再在中国被屏蔽了。
Cloudflare 现在提供 Google 的 AMP 缓存的替代方案:https://blog.cloudflare.com/accelerated-mobile/
Matt Mower post编辑了 gist 解释如何自托管 AMP 框架。这对我有用。
他的总结post:
- 构建 AMP 框架/下载 dist 文件(已列出 here)
- 从与 AMP HTML 文件相同的 http 服务器提供它们。
- 替换脚本
src
属性。即:<script async src="https://cdn.ampproject.org/v0.js"></script>
→ <script async src="<path_to_amp_files>/v0.js"></script>
- 自定义
runtime-host
元标记。在 head 元素中的任何脚本标记之前添加 <meta name="runtime-host" content="<path_to_amp_files>">
。
- 要点中
amp-geo-api
有更多解决方法。
有没有办法使用备用 CDN 来包含 AMP 需要的 JavaScript 主文件?可以使用与 https://cdn.ampproject.org/v0.js
不同的 URL 吗?是否有计划通过允许在中国未被阻止的其他 CDN 等来进一步开放它?
使用网络搜索返回的几个顶级代理,ampproject.org
似乎在中国被屏蔽了。这并不奇怪,因为其他 Google 属性已被阻止。
编辑:我应该提到我尝试复制文件并 运行 在本地,但是 AMP 验证程序在我尝试时抛出错误。
不幸的是,我认为主要 Javascript AMP 需要的源文件只能使用 https://cdn.ampproject.org
URL.
根据博客“Getting started with AMP Html, accelerated mobile pages”
AMP does this by creating new rules for bottlenecks: JavaScript and html elements that are considered slow are prohibited. JavaScript is only allowed using libraries provided by the CDN of Google itself.
也在他们的官方网页上:
Our goal with AMP HTML is reliable performance, so we designed it to be easily cacheable by content delivery networks (CDNs). Google is offering a service that delivers AMP HTML documents given their URL through its CDN. Others can use this service or make their own or serve AMP HTML pages from a plain-old-web-server.
JS应该不会再在中国被屏蔽了。
Cloudflare 现在提供 Google 的 AMP 缓存的替代方案:https://blog.cloudflare.com/accelerated-mobile/
Matt Mower post编辑了 gist 解释如何自托管 AMP 框架。这对我有用。
他的总结post:
- 构建 AMP 框架/下载 dist 文件(已列出 here)
- 从与 AMP HTML 文件相同的 http 服务器提供它们。
- 替换脚本
src
属性。即:<script async src="https://cdn.ampproject.org/v0.js"></script>
→<script async src="<path_to_amp_files>/v0.js"></script>
- 自定义
runtime-host
元标记。在 head 元素中的任何脚本标记之前添加<meta name="runtime-host" content="<path_to_amp_files>">
。 - 要点中
amp-geo-api
有更多解决方法。