AMP Error – boilerplate

This post solves the issue of amp boilerplate tags are malformed:

The mandatory text inside tag 'head > style[amp-boilerplate]' is missing or incorrect.

Cause was:

YUI compressor (PHP) for CSS in w3 total cache (instead of default minify compressor).

Solution:

Change the compressor back to Minify (default), save settings and purge cache.

Explanation:

The boilerplate style in head section for amp page include should this code:

<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>

If it doesn’t then google webmasters tools gives an error.

The YUI compressor was removing this code for some reason, resulting in empty boilerplate style tag.

Leave a Reply

Your email address will not be published.