next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Incremental Static Regeneration replaces `.amp` with `?amp=1`

Open wawoon opened this issue 4 years ago • 3 comments

Bug report

Describe the bug

  • When the page is built with Amp and SSG config, the output url of amp page becomes /foo.amp (routing is pages/[slug])
  • In the build phase, the non-amp page /foo refers to /foo.amp in <link rel="amphtml"> correctly.
  • However when Incremental Static Regeneration is turned on, the /foo.amp is replaced with /foo?amp=1

To Reproduce

set

  • amp: "hybrid"
  • add unstable_revalidate: 30 to getStaticProps return value.

reproduce: https://github.com/wawoon/next-amp-ssg-reproduce

yarn build yarn start go to http://localhost:3000/foo

Expected behavior

The non amp page should always refer to/foo.amp in <link rel="amphtml"> tag even if Incremental Static Regeneration is turned on.

Screenshots

initial access:

スクリーンショット 2020-06-17 12 59 06

after 30sec

スクリーンショット 2020-06-17 12 59 35

System information

  • macOS
  • Chrome
  • Next: 9.4.5-canary.12
  • Node: v12.14.1

Additional context

https://github.com/vercel/next.js/issues/13038 https://github.com/vercel/next.js/pull/13046

wawoon avatar Jun 17 '20 04:06 wawoon

@Timer can i take this one ?

mohamedsgap avatar Jun 20 '20 08:06 mohamedsgap

Sure!

Timer avatar Jun 22 '20 03:06 Timer

Any update?

ngocnv-0940 avatar Oct 27 '22 09:10 ngocnv-0940