Clicky

  1. Home
  2. Troubleshooting
  3. AMP Validation Errors and Solutions – Troubleshooting Google AMP Search Console

AMP Validation Errors and Solutions – Troubleshooting Google AMP Search Console

Google AMP as you know is the latest technology to 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 but it has to be in a right way or else it won’t pass the AMP validation.

Better Validation has been our number one priority while developing AMPforWP plugin, it provides even better validation than the AMP by Automattic plugin.

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.

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!

Things to remember before Jumping

  1. Real Examples: I’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 that the solution is either same or similar to the one provided in the guide.
  2. Always under progress: We’re constantly updating this troubleshooting guide as we find new solutions.
  3. It’s gonna be fine: AMP troubleshooting can be overwhelming. So, if you find yourself lost in this article, that’s perfectly normal. Just spend some time and it will help you understand the concept.
  4. Get involved: Please get involved with us from the comments section.

Divide the Errors into Categories:

error into categories

By default, GSC (Google Search Console) breaks down the errors into 10 categories.

  1. Prohibited or invalid use of HTML Tag
  2. AMP markup missing or incorrect
  3. Prohibited HTML Tag with AMP equivalent
  4. User-authored JavaScript found on page
  5. Invalid CSS stylesheet
  6. Major content mismatch
  7. Use of deprecated tags or attributes
  8. Minor content mismatch
  9. Invalid structured data element
  10. Add AMP structured data, if supported

We will also break the errors and their solutions into these categories.

1. Prohibited or invalid use of HTML Tag

  • 1) The attribute ‘xml:lang’ may not appear in tag ‘span’.

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:

Invalid use html tags

Solution: 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.

  • 2) Multiple Errors in Categories and Tags Pages

The attribute 'prefix' may not appear in tag 'html ⚡ for top-level html'.
The mandatory attribute 'amp-custom' is missing in tag 'style amp-custom'.
Tag or text which is only allowed inside the body section found outside of the body section.
The attribute 'style' may not appear in tag 'img'.
The attribute 'type' may not appear in tag 'noscript > style[amp-boilerplate] - old variant'.

Solution: If you are getting multiple errors in just category and tags pages, then you don’t need to worry about this because we do not have AMP on categories and tags. It will probably take a few weeks until Google reindexes all the pages properly.

  • 3) The attribute ‘target’ may not appear in tag ‘button’.

There is a target attribute in the AMP HTML which not allowed by the validation. When we run it with the AMP validator, we found this:

Traget Attribute

Solution: 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.

Back to you

Please share your issues in the below comments, we will try our best to help you provide solutions to them.

History: Last Updated: 12 Jan 2017

We are always updating this guide with better solutions as we find them.

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.

Ask your Questions Directly!
If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!
Updated on April 4, 2018

    Are you still looking for a solution?

    Then fill out the below form and we will reach out to you within a few hours.

    Was this article helpful?

    Related Articles

    Comments

    1. I’m getting these errors:

      1- The mandatory tag ‘amphtml engine v0.js script’ is missing or incorrect.

      2- The tag ‘amp-anim extension .js script’ is missing or incorrect, but required by ‘amp-anim’.

      3- The attribute ‘src’ in tag ‘amp-anim extension .js script’ is set to the invalid value ‘https://cdn.ampproject.org/v0/amp-anim-0.1.js’ defer=’defer’.

      4- The tag ‘script’ is disallowed except in specific forms.

    2. Hello,
      Again, I found some errors on your explanation. I did not include some punctuation errors. Please correct if you agree, and then erase this comment

      I was trying my best to help everyone by fixing their validation issues manually. I must have validated hundreds of AMP websites. ¨[validated, ]

      This means that there is an attribute in the HTML tags, which is [are] not allowed by AMP. When we checked [check] the source code of the AMP version, we found this:

      One is that you go to your WordPress content editor, find this and remove this tag ?
      One is that you go to your WordPress content editor, find this this tag, and remove it. ?

      By the way, in the example image, I cannot see how the xml:lang attribute is within span tags. important. To me, it is just before the opening tag of the span, but I am not much of an expert on HTML.

      There is a target attribute in the AMP HTML which is not allowed by

    3. I got this error: “Notice: Trying to get property of non-object”. The line that caused the problem is: $slug = $post->post_name;. Solved that by replacing “$post->post_name” with “get_post_field(‘post_name’, get_post())”.

    4. I have many error with my AMP, before was ok, i’m not sure what i have did that make so many error on my AMP. Now my AMP was missing from google search page. My site: indoseafarer.com

      Thanks in advance if you can answer this problem.

      Thanks

    5. I have noindex tag and need it to stay

      «If you want this tag then the second solution is that you use Content overwrite feature to serve different content to AMP version.»
      How to do it ?

    6. Hello,
      I want my amp Home, posts and pages to be without /amp/ URL ending like WordPress amp theme
      I can copy your design files to wp-content/theme/ampforwp/ but I will lose the plugin features

      Ex:
      the link : https://downiz.com/amp

      to be : https://downiz.com/ with amp support and with your plugin support

      Kind Regards,

    7. I m using infinite AMP tamplate but showing error in search console regarding Linked AMP version is invalid. Please suggest for us. My Site :www.latesttechno.in

      1. Hi Jay,

        Will you please provide us the URL of your website. So that we will check and will get back to you.

    8. I am getting errors with sitemap ,I am using plugin by automatic.

      My site is not indexing properly in the native mode . As I changed it to classic it is working properly . For Amp version I had to include amp in the URL.

      Ex: The Go News > is my website

      1.In native mode one of my article link “https://www.thegonews.com/how-to-setup-blogger-in-2019/” is loading fast .But not indexing.

      2.But in classic mode I had to include amp ie.
      https://www.thegonews.com/how-to-setup-blogger-in-2019/amp
      This is indexing properly. And loading faster in amp but in a simple interface.

      How I can index properly in the native mode ?. If you need proper details of my errros then mail us through contact@thegonews.com.

      1. I am getting errors with sitemap ,I am using plugin by automatic.

        My site is not indexing properly in the native mode . As I changed it to classic it is working properly . For Amp version I had to include amp in the URL.

        Ex: The Go News . Is my website

        1.In native mode one of my article link&it is not indexing:
        “https://www.thegonews.com/how-to-setup-blogger-in-2019/”

        2.But in classic mode I had to include amp ie.
        https://www.thegonews.com/how-to-setup-blogger-in-2019/amp

        This is indexing properly. And loading faster in amp
        but in a simple interface.

        How I can index properly in the native mode ?. If you need proper details of my errros then mail us through contact@thegonews.com.

      2. Hi Hithesh,

        We have checked your website and found that you are using our AMP for WP plugin and it seems all your pages are valid please wait for some more days and it will be indexed

    Leave a Comment