0
votes

I have an AMP website which has a valid amp page validated using AMP validator. The problem is that, for some of the pages sometime it is showing "Sorry this page is Not valid AMP HTML" error while searching on google and trying to access the page from google cache. after a few seconds it is auto redirecting to my AMP site.

amphtml & canonical links are valid on both AMP and Non-AMP page I have checked.

Also my page passed AMP validation successfully without any errors.

My Question is what could be the possible reason behind the google cache showing invalid AMP html although I have a valid AMP page?

What should be solution for this issue?

1
pls share the link - Bachcha Singh
There is some privacy issue that is why i can not share the links, but I just want the possible reason behind the google amp cache serve fail issue or if anyone already faced the issue and what could be the solution. thanks for your comment - Md. Ziyed Uddin
may be issue while google crawl, once it crawl again this will show fine - Bachcha Singh
Yes! I am also suspecting that :) - Md. Ziyed Uddin
did you check developer console on you're browser ? - CyC0der

1 Answers

0
votes

The Google AMP cache optimizes ("transforms") the page for faster display, which currently can make it invalid AMP. Google search is still happy however because it trusts the AMP cache to not break the page in the process. So if you validate the page in the cache you can get errors, but they don't matter. The page must have been valid AMP to get into the cache. (The optimizer does things like inline scripts. See https://github.com/ampproject/amp-toolbox/blob/master/packages/optimizer/README.md and https://github.com/ampproject/amphtml/blob/master/spec/amp-cache-modifications.md for more info.)

There is work to make optimized AMP so validators do not complain. I cannot find the link just now, but I think there was a proposal to add a special attribute to <html> to mark it as "transformed". This is a problem right now using the AMP optimizer on the origin because if you want to optimize the AMP pages on the origin, the AMP cache will think they are not valid. E.g. if you want to build your whole site with AMP, today you could have a canonical AMP page that is optimized, plus the AMP page unoptimized. That way you only author up one page, but the AMP cache fetches the valid AMP page (and optimizes it) and then if a user goes to the origin (e.g. following a link on the page) they get canonical origin pages as optimized AMP pages. The above work to mark optimized pages as valid will avoid the need to serve up two URLs. (This also overlaps with the efforts around signed exchanges.)