1

我在 Laravel 上制作了自定义 AMP 页面,今天我收到了搜索控制台错误:脚本标签包含无法解析的无效 json,但是当我检查 AMP 验证器时,它显示代码是有效的。

代码:

<amp-analytics type="gtag" data-credentials="include">
    <script type="application/json">
    {
      "vars" : {
        "gtag_id": "UA-xxxxxx-xx",
        "config" : {
          "UA-xxxxxx-xx": { "groups": "default" }
        }
      }
    }
    </script>
</amp-analytics>

删除此代码后,我没有收到警告并且也成功提交了验证请求。

这是网址:https ://wordkosh.com/amp/english-hindi/administrator-meaning-hindi

4

1 回答 1

2

我发现了同样的错误信息,我通过改变这个来解决:

<script type="application/json">

变成..

<script type="application/ld+json">

然后提交验证请求。这对我有用。

于 2020-02-21T21:29:04.750 回答