Update docs for AMP export behavior (#7940)

In versions prior to ^9, default export with AMP was to create a
`index.html` file for each page. This has changed in ^9.0 with intruduction of a new
configuration options `exportTrailingSlash`. Current docs for AMP
exports are not correct for this behaviour.

Fixes #7931
This commit is contained in:
Sudhir Mitharwal 2019-07-13 01:23:06 +05:30 committed by JJ Kasper
parent 45f80409dc
commit 9b7a2f5ab4

View file

@ -2318,14 +2318,16 @@ When using `next export` to statically prerender pages Next.js will detect if th
Hybrid AMP (`pages/about.js`) would output:
- `out/about/index.html` - with client-side React runtime
- `out/about.amp/index.html` - AMP page
- `out/about.html` - with client-side React runtime
- `out/about.amp.html` - AMP page
AMP-only (`pages/about.js`) would output:
- `out/about/index.html` - Optimized AMP page
- `out/about.html` - Optimized AMP page
During export Next.js automatically detects if a page is hybrid AMP and outputs the AMP version to `page.amp/index.html`. We also automatically insert the `<link rel="amphtml" href="/page.amp" />` and `<link rel="canonical" href="/" />` tags for you.
During export Next.js automatically detects if a page is hybrid AMP and outputs the AMP version to `page.amp.html`. We also automatically insert the `<link rel="amphtml" href="/page.amp" />` and `<link rel="canonical" href="/" />` tags for you.
> **Note**: When using `exportTrailingSlash: true` in `next.config.js`, output will be different. For Hybrid AMP pages, output will be `out/page/index.html` and `out/page.amp/index.html`, and for AMP-only pages, output will be `out/page/index.html`
### Adding AMP Components