2017-04-13 59 views
0

嗨我試圖整合我的頁面放大器https://www.ampproject.org/安培HTML頁面不valide

我已將文檔中的示例複製並粘貼到我的頁面中。

<!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> 

我試圖檢查我的頁面是否被識別爲放大器頁面。

所以我創建了一個新的路線,並將參數在我的Chrome控制檯中進行了調試驗證。

但我有這樣的錯誤:

技術AMP⚡HTML - 版本1491601970987個 http://local.dev/amp/actualites/test#development=1

validator.js:380 AMP驗證有錯誤:

validator.js:380 http://local.dev/amp/actualites/test:28:0 AMP文檔中不允許使用inline 'style'屬性。改爲使用'style amp-custom'標記。 (見 https://www.ampproject.org/docs/guides/responsive/style_pages

validator.js:380 http://local.dev/amp/actualites/test:28:69標籤 '腳本' 是不允許的,除了以特定形式。

validator.js:380 http://local.dev/amp/actualites/test:28:19029標記 '腳本'被禁止,除了特定的形式。

看起來好像這個頁面不是放大器。但我不明白,我只是拿出了例證文檔!

我做錯了什麼?

https://www.ampproject.org/docs/guides/debug/validate

回答

0

找到它了。我使用的是symfony這是一個php框架。

在dev模式下,框架在DOM中注入一個調試工具欄,其中包含html,js等等......因爲這個AMP是無效的。

爲甲階酚醛樹脂的問題,你可以在config_dev.yml文件中禁用工具欄或app.php

web_profiler: 
    toolbar: true 
運行PROD模式的網站