Making AMP page discoverable via javascript

55 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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