Support » Plugin: AMP for WP - Accelerated Mobile Pages » Comments-Count & CDATA Error

  • I’m getting the following errors on my AMP page:

    -The tag ‘comments-count’ is disallowed.

    -The text (CDATA) inside tag ‘style amp-custom’ contains ‘CSS !important’, which is disallowed.

    How can I fix these problems?

    Thank you in advance. Cheers! 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hey,

    If you could send a link of a validation report for your page, that would be much easier to use for help, you can get that by coping your site URL into the box on this page: https://validator.ampproject.org and then sending the URL once it has tested your page.

    As for the style problem, that’s an easy fix.

    AMP doesn’t allow “!important” in your CSS, just remove that tag from any and all of your custom CSS.

    Ok… here is a URL after testing its validation:

    https://validator.ampproject.org/#url=http%3A%2F%2Fwww.chuckiedreyfus.ph%2F2016%2F09%2Fairasia-airbus-a320neo%2F%3Famp

    By the way, regarding the !important style problem. If I remove this, won’t it also affect my CSS on my non-AMP posts?

    It depends on how you are loading your custom CSS in.

    You should be loading any custom CSS that you have via the custom CSS page within the settings within the AMP plugin on your WordPress dashboard. Those custom CSS styles will only be loaded for your AMP pages, not for anything else.

    The other error is probably due to your comments plugin, which is loading custom HTML in the page, that would need to be disabled in the plugin’s code to disallow the “comments-count” tag from being loaded.

    I’ve stuck a Github issue up for you:

    https://github.com/ahmedkaludi/Accelerated-Mobile-Pages/issues/100

    I see…

    But as I’ve checked… the !important tags are part of the styles.css of my current theme itself. I’m afraid that removing the !important tags might destroy the theme’s layout.

    Hey,

    I don’t actually think that they are. They have been inlined and they belong to the mash share plugin that you have. These are the offending tags:

    .mashsb-count{display:block!important;}}
    
    @media only screen and (max-width: 568px) and (min-width: 480px) {.mashsb-buttons a{height:17px!important;}}
    
    .mashsb-buttons a{text-decoration:none!important;}
    
    @media only screen and (max-width: 460px) and (min-width: 100px){.mashsb-buttons a{min-width:20px!important;width:41px!important;height:20px!important;}}
    
    @media only screen and (max-width: 460px) and (min-width: 100px){.mashsb-buttons a{min-width:20px!important;width:41px!important;height:20px!important;}}
    
    @media only screen and (max-width: 460px) and (min-width: 100px){.mashsb-buttons a{min-width:20px!important;width:41px!important;height:20px!important;}}

    If you don’t remove these !important tags then AMP won’t validate.

    Oh! Yeah… you’re right. Thanks!

    I took off the !important tags and the validation errors are gone. The only error left is the comments-count problem. I just don’t know exactly which plugin is causing the problem. I think it’s the facebook commenting plugin but not quite sure.

    Awesome, glad you fixed it. Also I’m pretty sure it is your Facebook commenting plugin yes.

    Would you have any idea on how to resolve this since it is an official Facebook plugin? (Considering how slow they usually reply if they do at all. 🙂

    Well it would need to disallowed in either the AMP plugin or the Facebook one, the author of this plugin has done something similar before, so it would require doing something similar to that, however, you would have to wait for an update.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hey @childsplay
    Thank you so much for using the plugin! We will fix this issue in the next update.

    Thank you @thetechnuttyuk for helping him 🙂

    Hi Ahmed…

    Were you able to make a fix for the Comments-Count error being caused by the Facebook commenting plugin?

    Here’s a sample error on my site:

    https://validator.ampproject.org/#url=http%3A%2F%2Fwww.chuckiedreyfus.ph%2F2016%2F07%2Ffreezer-burn-at-bonifacio-high-street-bgc%2Famp%2F

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Comments-Count & CDATA Error’ is closed to new replies.