I have a page that's only job is to point to other pages. It's a list of links to other posts and the other posts are static and known entirely at time of deployment.
At the end of the day structure for all the pages I'm creating will resemble this:
[country]/[state]/[city]
I'm assuming I'm the the first who has wanted to something like this... How can I do this?
I've tried using the getStaticPaths
and getStaticProps
in the index.js file but that's not allowed so maybe there's a way to chain the creation of these directories?
Just for a little bit more context, the way the structure currently works is like this
Canada
|---- Quebec
| |---- Montreal
|---- Ontario
| |---- Toronto
US
|---- North Carolina
| |---- Charlotte
|---- Florida
|---- Orlando
I want to make an index.js page that can build something that looks like this
Canada
------------------------
- [Quebec](Montreal)
- [Ontario](Toronto)
And
US
-----------------------
- North Carolina
- Florida
The city pages (Montreal, Toronto, Charlotte, Orlando) are generated at build time but the list of states isn't generated until the page is requested which makes the website slower than it needs to be (it can be entirely static and Next.js seems like a good tool for automating generating all these pages)