Search code examples
amp-htmlnext.js

Implementing AMP with Next.js


This one is more of a question (related to using AMP in Next.js application) than a technical issue. I tried getting it answered on Next.js spectrum channel but nobody seems to reply there.

I am trying to implement a hybrid page for AMP and came across a few things like:

  • using useAmp() hook to find out if the AMP version needs to be shown
  • appending amp=1 to the URL loads the AMP version

These things seem to work fine but I want to know how actually Google would serve the AMP version of our page? Would it crawl all pages (including AMP ones), and then cache the AMP ones or do we need to do something extra for that or is it something else that happens?

Any help would be appreciated.

Cheers


Solution

  • For those who might be looking for the same or similar issue.

    We created our AMP pages using the NextJS hybrid option and we were able to have it working fine but Google shows issues/errors on the AMP pages and we were not able to resolve all the issues while sticking to NextJS.

    So we decided to host AMP pages separately and now it shows that our AMP pages are valid (checked with Google's AMP Validator).