Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Google AMP Issue: “Custom Javascript Not Allowed”

  • #4305
    Avatar photo[anonymous]

    I checked on my Publii site after having submitted a sitemap days ago. After inspecting my main URL, it said the “AMP Page is invalid” due to custom Javascript not being allowed.

    I have AMP turned on in the Publii settings. I haven’t messed with anything. What’s going on? Please help as I want to make my new site discoverable and be able to use all Search Console features.

    Thanks,

    Jordan

    #4306
    Avatar photoBob

    You haven’t shared your website URL, so how can we check what’s going on?

    #4307
    Avatar photo[anonymous]

    Here’s the URL:

    https://blog.hopswrites.com/

    #4308
    Avatar photoBob

    The mentioned issue is caused by the fact that most likely you put the plausible.js script into the amp files. Remove it and validate the page once again, I think it should help.

    #4309
    Avatar photo[anonymous]

    Thank you for your time, Bob!

    I’m not a dev, so I hope this question makes sense: If I remove my Plausible code from AMP, will it still help me track mobile traffic?

    Also, where should I inject the Plausible code so it doesn’t disrupt the site?

    Thanks again for your help!

    #4310
    Avatar photoBob
    [anonymous] wrote:

    I’m not a dev, so I hope this question makes sense: If I remove my Plausible code from AMP, will it still help me track mobile traffic?

    The mobile yes, but not the AMP pages. I think you should ask the Plausible team about AMP page support, also have a look at this topic https://github.com/plausible/analytics/issues/220

    [anonymous] wrote:

    Also, where should I inject the Plausible code so it doesn’t disrupt the site?

    Put the code via Custom HTML tool -> Head

    #4312
    Avatar photo[anonymous]

    Thanks a ton! Will look into it.

    BTW, loving Publii so far! I’ve used Ghost and WordPress, and this is the best of both worlds (great UI with tons of flexibility).

    #4316
    Avatar photo[anonymous]

    Bob, thanks again. I checked out the Plausible GitHub issue page and contributed.

    I did review Google’s flagging of “custom Javascript, and it flagged Plausible and many other elements from the Body onwards. Are there any others using Publii with this issue? In the meantime, I may turn off AMP.

    Thanks!