Amphtml: Validator fails on boilerplate code copied from guide.

Created on 2 Apr 2016  路  5Comments  路  Source: ampproject/amphtml

I've added boilerplate code. It's the same in all guides, but validator fails, despite code is identical.

You can check it here: https://dikmax.name/post/satrip-2015-iguazu-falls/amp/#development=1.

Errors:

https://dikmax.name/post/satrip-2015-iguazu-falls/amp/:1:1444 The tag 'head > style : boilerplate - old variant' is deprecated - use 'head > style : boilerplate' instead. (see https://www.ampproject.org/docs/reference/spec.html#required-markup)
validator.js:384 https://dikmax.name/post/satrip-2015-iguazu-falls/amp/:1:1444 The mandatory text (CDATA) inside tag 'head > style : boilerplate - old variant' is missing or incorrect. (see https://www.ampproject.org/docs/reference/spec.html#required-markup)

But if you open page source and search for <style amp-boilerplate>... copied from guides, then you'll find it byte to byte.

AMP version 1458844805881

caching

Most helpful comment

Your boilerplate is correct. The validator is correct as well, but the error message is a bit confusing. The error it is complaining about is the <style> tag you have on the page rather than the <style amp-boilerplate> tag.

The position at line 1, col 1444 points directly at that <style> tag, which must have the amp-custom attr. See https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#author-stylesheets

All 5 comments

Your boilerplate is correct. The validator is correct as well, but the error message is a bit confusing. The error it is complaining about is the <style> tag you have on the page rather than the <style amp-boilerplate> tag.

The position at line 1, col 1444 points directly at that <style> tag, which must have the amp-custom attr. See https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#author-stylesheets

I've just come across this Issue after some confusion too. The error specifically mentions head > style : boilerplate - old variant when it isn't referring to the boilerplate style element at all. The real error is that a style element is being used without either amp-boilerplate or amp-custom attribute.

@chriswheeler , #4421 is probably the right bug to track this. Since it's taken us longer than I originally anticipated to retire the old boilerplate, it may be worth spending some effort to improve these errors.

Don't know what the status of this is, but I want to thank @chriswheeler because I have been getting this error as a result of my custom style tag. I am building my amp articles through rendering React components, and React will strip away custom attributes that don't end with a ="".

So while I was diff checking and scratching my head up above on the amp-boilerplate, I had missed <style amp-custom>

Would be great if the error message could improve.

This is definitely a confusingly worded error message, just changing the wording would ease a lot of frustration from people trying to figure this out.

Was this page helpful?
0 / 5 - 0 ratings