{"id":1961,"date":"2017-01-12T10:11:45","date_gmt":"2017-01-12T10:11:45","guid":{"rendered":"https:\/\/ampforwp.com\/?p=1961"},"modified":"2018-04-04T10:30:14","modified_gmt":"2018-04-04T10:30:14","slug":"amp-validator","status":"publish","type":"ht_kb","link":"https:\/\/ampforwp.com\/tutorials\/article\/amp-validator\/","title":{"rendered":"AMP Validation Errors and Solutions &#8211; Troubleshooting Google AMP Search Console"},"content":{"rendered":"<p>Google AMP as you know is the latest technology\u00a0to help accelerate the mobile pages, but it has strict standards as to what you can do, just like any good technology.<\/p>\n<p style=\"text-align: justify;\">AMP does not stop you from using your creativity. You can literally do anything you want on top of AMP but it has to be in a right way or else it won&#8217;t pass the AMP validation.<\/p>\n<p style=\"text-align: justify;\">Better Validation has been our number one priority while developing AMPforWP plugin, it provides even better validation than the AMP by Automattic plugin.<\/p>\n<p style=\"text-align: justify;\">Even if AMPforWP has the best validation support, Google search console will still report validation errors in Accelerated Mobile Pages section and there could be hundreds of reasons behind these error reports.<\/p>\n<p style=\"text-align: justify;\">I was trying my best to help everyone by fixing their validation issues manually in search console. I must have validated hundreds of AMP websites validated, I decided to make a troubleshooting guide which will help not only our users but to the whole AMP community!<\/p>\n<h2>Things to remember before\u00a0Jumping<\/h2>\n<ol>\n<li><strong>Real Examples:<\/strong> I&#8217;m posting these solutions and problems while debugging, so the code that you will see is from one of the users of the plugin. It is possible\u00a0that the solution is either same or similar to the one provided in the guide.<\/li>\n<li><strong>Always under progress:<\/strong> We&#8217;re constantly updating this troubleshooting guide as we find new solutions.<\/li>\n<li><strong>It&#8217;s gonna be fine<\/strong>:\u00a0AMP troubleshooting can be overwhelming. So, if you find yourself lost in this article, that&#8217;s perfectly normal. Just spend some time and it will help you understand the concept.<\/li>\n<li><strong>Get involved<\/strong>:\u00a0Please get involved with us from the comments section.<\/li>\n<\/ol>\n<h2>Divide the Errors into Categories:<\/h2>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-1965\" src=\"https:\/\/ampforwp.com\/wp-content\/uploads\/2017\/01\/AMP-Validation-Errors.png\" alt=\"error into categories\" width=\"718\" height=\"382\" \/><\/p>\n<p>By default, GSC (Google Search Console) breaks down the errors into 10 categories.<\/p>\n<ol>\n<li>Prohibited or invalid use of HTML Tag<\/li>\n<li>AMP markup missing or incorrect<\/li>\n<li>Prohibited HTML Tag with AMP equivalent<\/li>\n<li>User-authored JavaScript found on page<\/li>\n<li>Invalid CSS stylesheet<\/li>\n<li>Major content mismatch<\/li>\n<li>Use of deprecated tags or attributes<\/li>\n<li>Minor content mismatch<\/li>\n<li>Invalid structured data element<\/li>\n<li>Add AMP structured data, if supported<\/li>\n<\/ol>\n<p>We will also break the errors and their solutions into these categories.<\/p>\n<h3>1. Prohibited or invalid use of HTML Tag<\/h3>\n<ul>\n<li><strong>1) The attribute &#8216;xml:lang&#8217; may not appear in tag &#8216;span&#8217;.<\/strong><\/li>\n<\/ul>\n<p>This means that there is an attribute in the HTML tags, which are not allowed by AMP. When we check the source code of the AMP version, we found this:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-1971\" src=\"https:\/\/ampforwp.com\/wp-content\/uploads\/2017\/01\/xmllang-2.png\" alt=\"Invalid use html tags\" width=\"529\" height=\"111\" \/><\/p>\n<p><strong>Solution<\/strong>: There are two ways of fixing this: One is that you go to your WordPress content editor, find this and remove this tag. If you want this tag then the second solution is that you use Content overwrite feature to serve different content to AMP version.<\/p>\n<ul>\n<li><strong>2) Multiple Errors in Categories and Tags Pages<\/strong><\/li>\n<\/ul>\n<p><code>The attribute 'prefix' may not appear in tag 'html &#x26a1; for top-level html'.<br \/>\nThe mandatory attribute 'amp-custom' is missing in tag 'style amp-custom'.<br \/>\nTag or text which is only allowed inside the body section found outside of the body section.<br \/>\nThe attribute 'style' may not appear in tag 'img'.<br \/>\nThe attribute 'type' may not appear in tag 'noscript &gt; style[amp-boilerplate] - old variant'.<\/code><\/p>\n<p><strong>Solution:<\/strong> If you are\u00a0getting multiple errors in just category and tags pages, then\u00a0you don&#8217;t need to worry about this because we do not have AMP on categories and tags. It will probably\u00a0take\u00a0a few weeks until Google reindexes all the pages properly.<\/p>\n<ul>\n<li><strong>3) The attribute &#8216;target&#8217; may not appear in tag &#8216;button&#8217;.<\/strong><\/li>\n<\/ul>\n<p>There is a target attribute in the AMP HTML which\u00a0not allowed by the validation. When we run it with the AMP validator, we found this:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-1982\" src=\"https:\/\/ampforwp.com\/wp-content\/uploads\/2017\/01\/validator.png\" alt=\"Traget Attribute\" width=\"612\" height=\"357\" \/><\/p>\n<p><strong>Solution<\/strong>: There are two ways of fixing this: One is that you go to your WordPress content editor, find this and remove this tag. If you want this tag then the second solution is that you use Content overwrite feature to serve different content to AMP version.<\/p>\n<h3>Back to you<\/h3>\n<p>Please share your issues in the below comments, we will try our best to help you provide solutions to them.<\/p>\n<p><strong>History:\u00a0<\/strong>Last Updated: 12 Jan 2017<\/p>\n<p>We are always updating this guide with better solutions as we find them.<\/p>\n<p style=\"text-align: justify;\">These are common AMP errors reported in Google Search Console. Hope you have solved your error, if not then let us know what is the error you are facing in the comment section below.<\/p>\n<div id=\"div-1\" class=\"hkb-feedback\">\n\t\t\t<strong class=\"ht-mobile-exit__title\">Ask your Questions Directly!<\/strong><br>\n\t\t\t<div class=\"hkb_widget_exit__content\" style=\"font-size: 14px;\">If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!<\/div>\n\t\t\t<a href=\"https:\/\/ampforwp.com\/support\/#contact\" id=\"button\" target=\"_blank\" rel=\"noopener noreferrer\"><button>Yes, I have a Question<\/button><\/a>\n\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Google AMP as you know is the latest technology\u00a0to help accelerate the mobile pages, but it has strict standards as to what you can do, just like any good technology. AMP does not stop you from using your creativity. You can literally do anything you want on top of AMP&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"open","ping_status":"open","template":"","format":"standard","meta":[],"ht-kb-category":[5],"ht-kb-tag":[128,131,132],"_links":{"self":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/1961"}],"collection":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/comments?post=1961"}],"version-history":[{"count":5,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/1961\/revisions"}],"predecessor-version":[{"id":4516,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/1961\/revisions\/4516"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/media?parent=1961"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-category?post=1961"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-tag?post=1961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}