Categories: AMP - Guide

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:

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:

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:

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.

Share
Published by
Ahmed Kaludi

How to add Adobe Analytics in AMP

Follow these steps to add Adobe Analytics in AMP Step 1: Go to WordPress Admin Area -> AMP…

3 months ago

What is the CWV plugin all about

Core Web Vitals are the subset of Web Vitals that apply to all web pages,…

6 months ago

How to fix “Alternate page with proper canonical tag” Page Index issue in Google Search Console

The following reasons can be shown for non-indexing. Server error (5xx) Your server returned a 500-level…

7 months ago

Google Analytics ( GA4 ) integration in AMPforWP

We have added the Google Analytics 4 ( GA 4 ) integration in AMPforWP v1.0.80.…

12 months ago

How to add Marfell Analytics in AMP

In this article, I will show you how to add Dotmetrics Analytics to your AMP…

1 year ago

How to modify the H1-H6 size for mobile devices

In this option, we will show you how to modify the H1-H6 size for mobile…

1 year ago