anurag
anurag

Reputation: 630

Making AMP page discoverable via javascript

We have not AMP'ified all our pages and are using javascript/ajax call to discover whether AMP page exists and then add the "amphtml" discoverability to tag accordingly.

  1. Make AJAX call to the webserver to see whether there is an equivalent AMP page.
  2. If yes, add to the head.

Loading up the website in Chrome shows the equivalent AMP page via AMP Validator extension.

However, https://search.google.com/test/amp?id=pNgSex6yfpSGiMsd8OVzeQ says it's not a valid AMP page. Is this because I am adding the "amphtml" via javascript?

Upvotes: 0

Views: 53

Answers (1)

Aaron L.
Aaron L.

Reputation: 151

Is this because I am adding the "amphtml" via javascript?

Yes, you are modifying what is already an invalid AMP page and then serving it to the user with the modified html tag.

https://support.google.com/webmasters/answer/6340290

Upvotes: 1

Related Questions