Hi I'm trying to integrate my page for amp https://www.ampproject.org/.
I have taken the exemple in the documentation and copy paste it in my page.
<!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>
I'm trying to check if my page is recognize as an amp valide page.
So I have created a new route and put the argument to have the debug validation in my chrome console.
But I have this errors:
Powered by AMP ⚡ HTML – Version 1491601970987 http://local.dev/amp/actualites/test#development=1
validator.js:380 AMP validation had errors:
validator.js:380 http://local.dev/amp/actualites/test:28:0 The inline 'style' attribute is not allowed in AMP documents. Use 'style amp-custom' tag instead. (see https://www.ampproject.org/docs/guides/responsive/style_pages)
validator.js:380 http://local.dev/amp/actualites/test:28:69 The tag 'script' is disallowed except in specific forms.
validator.js:380 http://local.dev/amp/actualites/test:28:19029 The tag 'script' is disallowed except in specific forms.
It seems like the page is not amp valide. But I don't understand, I just took the exemple documentation!!!
What did I do wrong?
Found it. I'm using symfony which is a php framework.
In dev mode the framework inject in the DOM a debug toolbar which content html, js, etc... Because of that AMP is not valid.
To resole the problem you can disable the toolbar in the config_dev.yml
file or run the site in prod mode with app.php
web_profiler:
toolbar: true