Search code examples
google-search-consoleamp-html

AMP errors in web master tool


I have implemented AMP successfully for my webpages and google started indexing it, which I came to know via WebMaster tool. I am facing some issues which is present and disappears in short span of time. Issue logged are:

  1. User authored JavaScript found on page The pages doesn't contain any script tags except schema. This error is showing for few pages from 120 pages instead of following same

template. Below is the image link:

enter image description here

Have some more query:

  1. I have observe different amp urls getting redirected to its original page when the same amp url is being used in Web Browser. Is Google taking care of it or its on us to do the redirection?

  2. I am planning to implement the sign in and share buttons on my web pages which will be using javascript. But if I do so, I do get validation error. So what is the right approach.

Can anyone please help me on this?


Solution

    1. Please ensure that all script tags are of type application/ld+json. There should be no executable code in these script tags.
    2. Redirection is something that you must be doing on your end. Google doesn't do any sort of redirection from AMP to non-amp pages if the URL is hit directly. In fact that URL schema that Google uses in their carousel is entirely their own, and just includes the path to your page inside it. E.g. https://cdn.ampproject.org/v/www.yoursitehere.com/path/to/article.html
    3. Social sharing using Javascript inserted in the page is not allowed, as no Javascript is allowed. If you want to use social sharing, use a non-javascript implemention, or try out the amp-social-share