2017-08-03 107 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

但是我仍然收到相同的錯誤 –