You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you pull a list of paths from a source [index, about, blah, contact, etc.], how do you SSG your site with Dynamic Routes (using getStaticProps/getStaticPaths) but have the homepage resolve as somedomain.com/ ?
I have the rest of the code working, but on building it exports the homepage as /index/index.html instead of /index.html which obviously means hitting the root domain just 404's (but somedomain.com/index works fine!).
I can redirect/ to /index and it works great, but that's probably not a clean solution.
And if I copy and paste the code of pages/[slug].js into pages/index.js it works fine but that's a pretty ugly solution as you need to maintain 2 lots of code.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey all,
If you pull a list of paths from a source [index, about, blah, contact, etc.], how do you SSG your site with Dynamic Routes (using getStaticProps/getStaticPaths) but have the homepage resolve as
somedomain.com/
?I have the rest of the code working, but on building it exports the homepage as
/index/index.html
instead of/index.html
which obviously means hitting the root domain just 404's (but somedomain.com/index works fine!).I can redirect
/
to/index
and it works great, but that's probably not a clean solution.And if I copy and paste the code of
pages/[slug].js
intopages/index.js
it works fine but that's a pretty ugly solution as you need to maintain 2 lots of code.I found this example code but that doesn't seem to work for me.
Am I missing something obvious?
Thanks for any pointers :)
Beta Was this translation helpful? Give feedback.
All reactions