【问题标题】:The mandatory text (CDATA) inside tag 'head > style[amp-boilerplate]' is missing or incorrect标签“head > style[amp-boilerplate]”中的强制文本 (CDATA) 缺失或不正确
【发布时间】:2017-02-15 22:00:22
【问题描述】:

为什么我会收到此错误消息?我使用 wordpress 并使用 Automattic AMP 插件。

标签“head > style[amp-boilerplate]”中的强制文本 (CDATA) 缺失或不正确。 MANDATORY_AMP_TAG_MISSING_OR_INCORRECT 第 1 行,第 473 列

标签“noscript > style[amp-boilerplate]”中的强制文本 (CDATA) 缺失或不正确。 MANDATORY_AMP_TAG_MISSING_OR_INCORRECT 第 10 行,第 19 列

<!doctype html><html amp lang="tr-TR"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><title>Example</title><link rel="canonical" href="http://www.example.com/okul-kombinleri/" /> <script src="https://cdn.ampproject.org/v0.js" async></script> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic"><style amp-boilerplate>body {
-webkit-animation:0 8s steps(1,end) 0 1 normal both;
-moz-animation:0 8s steps(1,end) 0 1 normal both;
-ms-animation:0 8s steps(1,end) 0 1 normal both;
animation:0 8s steps(1,end) 0 1 normal both;
}

to {
visibility:visible;
}</style><noscript><style amp-boilerplate>body {
-webkit-animation:none;
-moz-animation:none;
-ms-animation:none;
animation:none;
}</style></noscript> 

【问题讨论】:

标签: wordpress mobile amp-html


【解决方案1】:

根据 AMP HTML 规范,我认为您需要从 AMP 样板代码中删除所有新行,因为它已使用正则表达式(正则表达式)进行验证,因此所有新行都被读取为“\ n" 导致错误。

直接来自文档

AMP 样板代码('head > style[amp-boilerplate]' 和 'noscript > style[amp-boilerplate]')

AMP HTML 文档的 head 标记中必须包含以下样板文件。目前验证是通过正则表达式完成的,因此尽可能减少突变很重要。目前,允许的突变是:(1)在样式标签打开后立即插入任意空格,并在其关闭前立即插入; (2) 用任意空格替换下面sn-p中的任何空格。

amphtml/spec/amp-boilerplate.md

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-01-16
    • 1970-01-01
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    • 2016-07-30
    • 2014-03-23
    • 1970-01-01
    相关资源
    最近更新 更多