wordpress - https://www.google.com/amp/s/siachenstudios.com/ 提供的 amp 页面中未显示图标
问题描述
当 amp 页面由 google amp CDN 提供时图标未显示,即 - https://www.google.com/amp/s/siachenstudios.com/yg-drops-new-protest-track-ftp/%3famp
但是,如果我的域为 amp 页面提供服务,图标可以正常工作 - https://siachenstudios.com/yg-drops-new-protest-track-ftp/?amp
如何修复 google amp 缓存域上的图标?
解决方案
我检查了这两个站点并观察到从谷歌缓存字体系列加载的 AMP 站点时 - mobile-theme.ttf 失败并出现 404。
从缓存加载时,字体系列 src url 明显变化
从缓存加载时的 AMP 页面字体系列 -
@font-face{font-family:"mobile-theme";
src:url('https://siachenstudios-com.cdn.ampproject.org/r/s/siachenstudios.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.eot?9');
src:url('https://siachenstudios-com.cdn.ampproject.org/r/s/siachenstudios.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.eot?9#iefix') format("embedded-opentype"),
url('https://siachenstudios-com.cdn.ampproject.org/r/s/siachenstudios.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.woff?9') format("woff"),
url('https://siachenstudios-com.cdn.ampproject.org/r/s/siachenstudios.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.ttf?9') format("truetype"),
url('https://siachenstudios-com.cdn.ampproject.org/r/s/siachenstudios.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.svg?9#mobile-theme') format("svg");
font-weight:normal;
font-style:normal
}
返回 404。
从没有缓存的 url 加载时的 AMP 页面字体系列 -
@font-face{
font-family:"mobile-theme";src:url("https://siachenstudios.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.eot?9");
src:url("https://siachenstudios.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.eot?9#iefix") format("embedded-opentype"),
url("https://siachenstudios.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.woff?9") format("woff"),
url("https://siachenstudios.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.ttf?9") format("truetype"),
url("https://siachenstudios.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.svg?9#mobile-theme") format("svg");font-weight:normal;
font-style:normal
}
我建议您是否使用 AMP 建议的字体以外的本地字体。
AMP 建议的字体系列 - https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/custom_fonts/
您应该使用 amp-font 组件来添加其他字体。参考 - https://amp.dev/documentation/examples/components/amp-font/
推荐阅读
- node.js - 为什么不使用 NodeJS 中的 API 就无法获取所有 Instagram 帖子
- ansible - Ansible 调试消息到变量
- linux - 背景和顶栏配置在启动时不适用
- python - 有没有办法强制随机森林回归器不适合截距?
- vst - 无法让任何声音驱动程序为 Samplitude 工作
- python - 如何在 Python 中跟踪函数调用?
- reactjs - 用 span 替换字符串的每个字母
- javascript - 错误 [ERR_HTTP_HEADERS_SENT]:在将标头发送到客户端后无法设置标头。尝试使用 HTTP 发送数据
- php - 如何使用 PASSWORD() 函数加密变量?
- go - 如何根据父列有条件地预加载子项?