Support » Plugin: AMP » 7 AMP Pages out of 35 not “AMP URL”

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Pascal Birchler

    (@swissspidy)

    Hi @jeremybackpacker

    If you check the source code of these pages, you’ll indeed see a few instances of JavaScript being printed on the page, which in turn makes it invalid AMP.

    In the source code of https://jeremybackpacker.com/cote-ouest-australie-itineraire-roadtrip/amp/ you’ll see some invalid JavaScript even before the opening <html> tag, which makes the HTML even more invalid. Here’s an example:

    <script type="text/javascript">var bhittani_plugin_kksr_js = {"nonce":"3e11c4c0ba","grs":true,"ajaxurl":"https:\/\/jeremybackpacker.com\/wp-admin\/admin-ajax.php","func":"kksr_ajax","msg":"As-tu trouv\u00e9 cet article utile ?","fuelspeed":400,"thankyou":"Merci pour ton vote !","error_msg":"Oups.","tooltip":"1","tooltips":[{"tip":"","color":"#ffffff"},{"tip":"","color":"#ffffff"},{"tip":"","color":"#ffffff"},{"tip":"Merci ! Que t\\'a-t-il manqu\u00e9 pour mettre 5 \u00e9toiles ?","color":"#ffffff"},{"tip":"Wow, Merci \u00e9norm\u00e9ment !","color":"#ffffff"}]};</script> <script type="text/javascript">var bhittani_plugin_kksr_js = {"nonce":"3e11c4c0ba","grs":true,"ajaxurl":"https:\/\/jeremybackpacker.com\/wp-admin\/admin-ajax.php","func":"kksr_ajax","msg":"As-tu trouv\u00e9 cet article utile ?","fuelspeed":400,"thankyou":"Merci pour ton vote !","error_msg":"Oups.","tooltip":"1","tooltips":[{"tip":"","color":"#ffffff"},{"tip":"","color":"#ffffff"},{"tip":"","color":"#ffffff"},{"tip":"Merci ! Que t\\'a-t-il manqu\u00e9 pour mettre 5 \u00e9toiles ?","color":"#ffffff"},{"tip":"Wow, Merci \u00e9norm\u00e9ment !","color":"#ffffff"}]};</script> <script type="text/javascript">var bhittani_plugin_kksr_js = {"nonce":"3e11c4c0ba","grs":true,"ajaxurl":"https:\/\/jeremybackpacker.com\/wp-admin\/admin-ajax.php","func":"kksr_ajax","msg":"As-tu trouv\u00e9 cet article utile ?","fuelspeed":400,"thankyou":"Merci pour ton vote !","error_msg":"Oups.","tooltip":"1","tooltips":[{"tip":"","color":"#ffffff"},{"tip":"","color":"#ffffff"},{"tip":"","color":"#ffffff"},{"tip":"Merci ! Que t\\'a-t-il manqu\u00e9 pour mettre 5 \u00e9toiles ?","color":"#ffffff"},{"tip":"Wow, Merci \u00e9norm\u00e9ment !","color":"#ffffff"}]};</script>

    This JS should be completely removed on AMP pages.

    Hi Pascal,

    Thank you so much for your quick answer.

    I try to remove this invalid JS and see what google says. You reckon it’ll be the same issue for all of them ? (sorry not a pro so your help is precious to me haha)

    But how this JS ended up in the AMP page in the first place ? That’s the thing i dont get as I havent done anything in particular to those pages.

    Thanks again, i’ll make sure to give you a rate if this works out!

    Jeremy

    Question may sound silly to you but, what’s the easiest way to remove this invalid JS from the code ?

    Sorry and thanks for your help.

    Jeremy

    Plugin Author Pascal Birchler

    (@swissspidy)

    It looks like all pages are affected by the same issue, so if you can solve it once, it should fix all of them.

    Is it possible that you are using the kk Star Ratings plugin? The code looks like it comes from that plugin.

    So the first step would be to temporarily deactivating the plugin and then re-running the AMP validation.

    Once it’s clear that the plugin is the culprit, there are a few options:

    1. Keep the plugin disabled.
    2. Replace the plugin with another, more AMP-compatible one.
    3. Ask the author on GitHub to make the plugin aware of AMP, so that the JS is not enqueued on an AMP page at all, for example.
    4. Try to dequeue the JavaScript code yourselves, for example in your child theme’s functions.php file.
    Plugin Author Weston Ruter

    (@westonruter)

    Here is a new star rating plugin that is AMP-compatible: https://github.com/billerickson/BE-Comment-Rating

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.