Recently we enabled Google AMP (Accelerated Mobile Pages) and since then are dealing with multiple Validation Errors. Automattic (WordPress) has a plugin that generates the required compatible pages, and Yoast has came out with a Glue plugin that adds a few items Automattic’s Plugin leaves out.
But Google has outlawed Script commands that seem to be the greatest majority of our amp validation errors. We are running under a CloudFlare pro-account, their main script that loads CloudFlare performance options, (Mirage, Polish, Email Obfuscation, Rocket Loader, etc) is outlawed by Google AMP.
This is the fix that gives us the best option. CloudFlare custom page rule turns off Rocket Loader, Auto Minify, Polish, and Mirage. Credit to this helpful article on wppressurecooker.com . Our AMP page errors are quickly dropping in Webmaster Tools. Besides, we really don’t need acceleration on our amp posts.
Also you should have CloudFlare’s WordPress specific app installed, and set it to disable HTTPS Protocol Rewriting. Otherwise your AMP posts will have multiple errors.
Another WordPress plugin we use is CleanTalk which is an excellent anti-spam plugin that works better than Akismet. But AMP is erring on it’s script command just like CloudFlare’s script.
Script: Prohibited unless the type is
application/ld+json. (Other non-executable values may be added as needed.) Exception is the mandatory script tag to load the AMP runtime and the script tags to load extended components.
Update 03/30/2016: CleanTalk has updated their anti-spam plugin to be amp compatible. I highly recommend this plugin to keep your blog spam free. CleanTalk also has a built in Firewall that will deny blocked IPs from reaching your blog.
Here is a speed test comparison done on Pingdom.com between this articles standard post and it’s amp version. Despite disconnecting CloudFlare acceleration services on the AMP post the page ranked at 90% faster than most websites!
Update 08/22/16: This AMP specific CloudFlare page rule is no longer needed. CF has updated their system to support AMP Pages.
Also WordPress websites / blogs running under CloudFlare should have the official CF Plugin active, and toggling OFF HTTPS Protocol Rewriting. Failure to do this step will cause errors in your AMP Pages!
Oh well – Just my two cents worth as usual 😉