1
votes

Same question and symptoms as this question but maybe a different cause (the answer didn't offer any clues for me), plus I have to create a new question because I've just signed up... now hoping for help :o)

I get this validation error when validating an AMP page:

The mandatory text (CDATA) inside tag 'head > style : boilerplate' is missing or incorrect.

I've followed all the guidelines here, including adding the AMP boilerplate code in the head section.

The validator points to this chunk of code, which is as prescribed by the AMP project:

<noscript><style amp-boilerplate>
     body {
         -webkit-animation: none;
         -moz-animation: none;
         -ms-animation: none;
         animation: none;
     }
</style></noscript>

I can't see a problem with the above... Can anybody else offer any advice or pointers please?

I'm creating the AMP page in an Umbraco 7 template if that makes a difference...

EDIT:

Here's the HTML output...

UPDATE: I just found and ran this markup through https://developers.google.com/structured-data/testing-tool/ and it produced a different error Missing ',' or '}' in object declaration. which I can't spot... maybe problem relates to my JSON-LD...?

<!doctype html>
<html amp lang="en">
<head>
    <meta charset="utf-8">
        <title>Blah shortlisted at Awards for Excellence 2015</title>
    <link rel="canonical" href="http://somedomain.local/news-media/news-media-headlines/2015/oct/blah-shortlisted-at-awards-for-excellence-2015/" />
    <link href='https://fonts.googleapis.com/css?family=Roboto:500,400italic,300,700,400|PT+Sans:700' rel='stylesheet' type='text/css'>
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

    <script type="application/ld+json">
        {
        "@context": "http://schema.org",
        "@type": "NewsArticle",
        "mainEntityOfPage": "http://somedomain.local/news-media/news-media-headlines/2015/oct/blah-shortlisted-at-awards-for-excellence-2015/",
        "headline": "Blah shortlisted at Awards for Excellence 2015",
        "description": "We&#39;re delighted to announce that Blah has been shortlisted for the &#39;Blah &amp; blah blah&#39; award at the...",
        "datePublished": "10/28/2015 9:43:57 AM",
        "author": {
                "@type": "Organization",
                "name": "Name here"
            },
        "publisher": {
                "@type": "Organization",
                "name": "Name here",
                "logo": {
                "@type": "ImageObject",
                "url": "https://www.somedomain.com/img/logo.png",
                "width": 600,
                "height": 60
            },
        "image": {
                "@type": "ImageObject",
                "url": "https://www.somedomain.com/img/logo.png",
                "height": 50,
                "width": 165
            }
        }
    </script>



    <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>





    <style amp-custom>
        body {
            font-family: 'Roboto', sans-serif;
        }

        .sub-heading {
            padding-left: 1rem;
            padding-top: 0;
            padding-bottom: 1em;
            margin: 0;
            color: #fff;
        }

        body > div {
            padding: 1rem;
        }

        h1, h2 {
            color: #fff;
            padding: 1rem;
            margin: 0;
        }

        h1, .sub-heading {
            background-color: #009ed4;
        }

        h2 {
            background-color: #00618e;
            font-weight: 400;
            font-size: 1.25em;
        }

        amp-img {
            max-width: 100%;
        }

        .logo {
            margin: 1em;
        }
    </style>

    <script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
    <a href="/"><amp-img width="165" height="50" class="logo" src="https://www.somedomain.com/img/logo.png" alt="Logo"></amp-img></a>
        <h1>Blah shortlisted at Awards for Excellence 2015</h1>
            <p class="sub-heading">26 October 2015</p>
            <h2>We&#39;re delighted to announce that...</h2>
    <div><p>This year is the 16th... </p>
<p ><amp-img layout="responsive" width="500"height="281" src="/media/9348/et.jpg?width=500&amp;height=281"  /></amp-img></p>
<p><a href="http://www.google.co.uk/" target="_blank" title="blah">blah blah</p>
<p ><amp-img layout="responsive" width="500"height="281" src="/media/9349/som.jpg?width=500&amp;height=281"  /></amp-img></p>
<p>orem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque augue nibh, congue eu dictum at, interdum et libero. Etiam malesuada vehicula felis, vel varius odio semper sit amet. Phasellus quis sapien sed turpis porta lobortis. Aenean rutrum risus ut scelerisque mollis. Suspendisse id feugiat erat.</p>
<p><amp-img layout="responsive" width="500"height="306.452" src="/media/9350/the_shining.jpg?width=500&amp;height=306.4516129032258" alt="alt text here" /></amp-img></p>
<p>"quote here." orem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque augue nibh, congue eu dictum at, interdum et libero. Etiam malesuada vehicula felis, vel varius odio semper sit amet. Phasellus quis sapien sed turpis porta lobortis. Aenean rutrum risus ut scelerisque mollis. Suspendisse id feugiat erat.</p>
<p> </p>
<div>
<div>orem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque augue nibh, congue eu dictum at, interdum et libero. Etiam malesuada vehicula felis, vel varius odio semper sit amet. Phasellus quis sapien sed turpis porta lobortis. Aenean rutrum risus ut scelerisque mollis. Suspendisse id feugiat erat.</div>
</div></div>
</body>
</html>
3

3 Answers

1
votes

You need to have full amp boilerplate code.

Replace your multiline boilerplate 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>

with this:

<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>

Allways up to date code is here: https://github.com/ampproject/amphtml/blob/master/spec/amp-boilerplate.md

You have json syntax error in Publisher part.

    "publisher": {
            "@type": "Organization",
            "name": "Name here",
            "logo": {
                "@type": "ImageObject",
                "url": "https://www.somedomain.com/img/logo.png",
                "width": 600,
                "height": 60
            } // You forget to close logo object.
     },

Your AMP syntax errors:

Required:

The width of the image, in pixels. Images should be at least 696 pixels wide.

Recommended (and if added pass the test):

The date and time the article was most recently modified, in ISO 8601 format. If the article has never been modified, you can omit this property or use the same date as datePublished.

Another important thing is that URL's for images shouldn't be relative paths.

Here is your (modified - i replaced boilerplate code and images links) html:

<!doctype html>
<html amp lang="en">
<head>
    <meta charset="utf-8">
        <title>Blah shortlisted at Awards for Excellence 2015</title>
    <link rel="canonical" href="http://somedomain.local/news-media/news-media-headlines/2015/oct/blah-shortlisted-at-awards-for-excellence-2015/" />
    <link href='https://fonts.googleapis.com/css?family=Roboto:500,400italic,300,700,400|PT+Sans:700' rel='stylesheet' type='text/css'>
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
    <script type="application/ld+json">
        {
        "@context": "http://schema.org",
        "@type": "NewsArticle",
        "mainEntityOfPage": "http://somedomain.local/news-media/news-media-headlines/2015/oct/blah-shortlisted-at-awards-for-excellence-2015/",
        "headline": "Blah shortlisted at Awards for Excellence 2015",
        "description": "We&#39;re delighted to announce that Blah has been shortlisted for the &#39;Blah &amp; blah blah&#39; award at the...",
        "datePublished": "10/28/2015 9:43:57 AM",
        "dateModified": "10/28/2015 9:43:57 AM",
        "author": {
                "@type": "Organization",
                "name": "Name here"
            },
        "publisher": {
                "@type": "Organization",
                "name": "Name here",
                "logo": {
                "@type": "ImageObject",
                "url": "https://www.somedomain.com/img/logo.png",
                "width": 600,
                "height": 60
                }
            },
        "image": {
                "@type": "ImageObject",
                "url": "https://www.somedomain.com/img/logo.png",
                "height": 50,
                "width": 700
            }
        }
    </script>
    <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>
    <style amp-custom>
        body {
            font-family: 'Roboto', sans-serif;
        }
        .sub-heading {
            padding-left: 1rem;
            padding-top: 0;
            padding-bottom: 1em;
            margin: 0;
            color: #fff;
        }
        body > div {
            padding: 1rem;
        }
        h1, h2 {
            color: #fff;
            padding: 1rem;
            margin: 0;
        }
        h1, .sub-heading {
            background-color: #009ed4;
        }
        h2 {
            background-color: #00618e;
            font-weight: 400;
            font-size: 1.25em;
        }
        amp-img {
            max-width: 100%;
        }
        .logo {
            margin: 1em;
        }
    </style>
    <script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
    <a href="/"><amp-img width="165" height="50" class="logo" src="http://i.kinja-img.com/gawker-media/image/upload/s--pEKSmwzm--/c_scale,fl_progressive,q_80,w_800/1414228815325188681.jpg" alt="Logo"></amp-img></a>
        <h1>Blah shortlisted at Awards for Excellence 2015</h1>
            <p class="sub-heading">26 October 2015</p>
            <h2>We&#39;re delighted to announce that...</h2>
    <div><p>This year is the 16th... </p>
<p ><amp-img layout="responsive" width="500"height="281" src="http://i.kinja-img.com/gawker-media/image/upload/s--pEKSmwzm--/c_scale,fl_progressive,q_80,w_800/1414228815325188681.jpg"  /></amp-img></p>
<p><a href="http://www.google.co.uk/" target="_blank" title="blah">blah blah</p>
<p ><amp-img layout="responsive" width="500"height="281" src="http://i.kinja-img.com/gawker-media/image/upload/s--pEKSmwzm--/c_scale,fl_progressive,q_80,w_800/1414228815325188681.jpg"  /></amp-img></p>
<p>orem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque augue nibh, congue eu dictum at, interdum et libero. Etiam malesuada vehicula felis, vel varius odio semper sit amet. Phasellus quis sapien sed turpis porta lobortis. Aenean rutrum risus ut scelerisque mollis. Suspendisse id feugiat erat.</p>
<p><amp-img layout="responsive" width="500"height="306.452" src="http://i.kinja-img.com/gawker-media/image/upload/s--pEKSmwzm--/c_scale,fl_progressive,q_80,w_800/1414228815325188681.jpg" alt="alt text here" /></amp-img></p>
<p>"quote here." orem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque augue nibh, congue eu dictum at, interdum et libero. Etiam malesuada vehicula felis, vel varius odio semper sit amet. Phasellus quis sapien sed turpis porta lobortis. Aenean rutrum risus ut scelerisque mollis. Suspendisse id feugiat erat.</p>
<p> </p>
<div>
<div>orem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque augue nibh, congue eu dictum at, interdum et libero. Etiam malesuada vehicula felis, vel varius odio semper sit amet. Phasellus quis sapien sed turpis porta lobortis. Aenean rutrum risus ut scelerisque mollis. Suspendisse id feugiat erat.</div>
</div></div>
</body>
</html>
1
votes

Very useful and relevant advice from Pawel on the image URLs and JSON-LD error, which I used to correct my markup. In addition to that, the precise, final cause of my specific issue was a result of cutting/pasting the correct boilerplate code into Visual Studio... VS automatically reformatted the code and added spaces to the styles in the <noscript> tag. This is the reason validation still failed. So, make sure VS doesn't 'helpfully' reformat - there shouldn't be any space characters. Sigh...

0
votes

You are missing a closing } in the JSON-LD script. Add the } after publisher height