Static export of folders with index file creates html file with name of the folder
See original GitHub issueBug report
Describe the bug
With Next 9 the new default is exporting paths as html files with the name of the path (see here).
However, this also has extended to folder with an explicit index file in them.
For example pages/folder1/index.jsx
will get outputted as out/folder1.html
this leads to webservers displaying the contents of that folder instead of the html file you would expect.
To Reproduce
Clone https://github.com/jaredpereira/next-export-bug-repro
npm i && npm run export
- Inspect
out
or serve w/ now.sh
Expected behavior
The expected behavior is for pages/folder1/index.jsx
, next export
should output out/folder1/index.html
Additional context
Add any other context about the problem here.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to keep nextjs index files inside their respective folders ...
this post is quite old but I just faced this issue today, in your next.config.js make sure to add trailingSlash: true , like:...
Read more >Advanced Features: Static HTML Export | Next.js
During next build , getStaticProps and getStaticPaths will generate an HTML file for each page in your pages directory (or more for dynamic...
Read more >Configuring an index document - Amazon Simple Storage ...
Create an index.html file. ... Save the index file locally. The index document file name must exactly match the index document name that...
Read more >HTML Files are missing - WordPress.org
Checking if web server can read from Temp Files Directory: /var/www/html/wp-content/plugins/simply-static-master/static-files/ ⟶ x Fail.
Read more >Publishing Org-mode files to HTML
The first file we add to that folder (and to subdirectories later on) is called index.org . This name was choosen, since Org...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this is mentioned here. https://github.com/zeit/next.js#usage
You can add
exportTrailingSlash
option to your Next config and preserve the same functionality as before Next 9.@devisscher
exportTrailingSlash
results in every file being given it’s own folder with anindex.html
inside. That does resolve the problem in that it’ll work when served but it is a bit of an odd work around. The expected outcome here I think would be a 1:1 mapping of input files to output files, where index files are created when they exist in the input. I may be misunderstanding something obvious here though!