2017-08-03 109 views
0

我在C#中创建了一个AMP页面。我在开发模式下遇到以下错误。创建C#AMP时出错页面

The tag 'script' is disallowed except in specific forms. 

我没有给出页面的任何外部脚本。这里是我的.cshtml代码。请检查它并说出为什么我会收到错误。在此先感谢 .cshtml代码

@{ 
    Layout = null; 
} 
<!doctype html> 
<html ⚡> 
<head> 
    <meta charset="utf-8"> 
    <link rel="canonical" href="self.html" /> 
    <meta name="viewport" content="width=device-width,minimum-scale=1"> 
    <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> 
<script async src="https://cdn.ampproject.org/v0.js"></script> 
</head> 
<body> 
    Hello, AMP world. 
</body> 
</html> 
+0

,那么它会将其识别为功放页面 –

回答

0

script标签禁止除非类型是application/ld+json

你能试试这个样本amp project基本标记:如果这个脚本删除

<!doctype html> 
<html amp lang="en"> 
    <head> 
    <meta charset="utf-8"> 
    <script async src="https://cdn.ampproject.org/v0.js"></script> 
    <title>Hello, AMPs</title> 
    <link rel="canonical" href="http://example.ampproject.org/article-metadata.html"> 
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> 
    <script type="application/ld+json"> 
     { 
     "@context": "http://schema.org", 
     "@type": "NewsArticle", 
     "headline": "Open-source framework for publishing content", 
     "datePublished": "2015-10-07T12:02:41Z", 
     "image": [ 
      "logo.jpg" 
     ] 
     } 
    </script> 
    <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> 
    </head> 
    <body> 
    <h1>Welcome to the mobile web</h1> 
    </body> 
</html> 
+0

但是我仍然收到相同的错误 –