I want to transfer my blog from Jekyll to NextJS and looking how to specify custom URLs. I followed the official NextJS guide on their website, but the routing part was relatively simple. From docs, I got that URLs are based on folders/files structure, but I want to have a subfolder per site topic in the pages folder but keep URLs flat. Something like that:
- pages (top-level folder)
- investing (subfolder)
- how-to-start-investing.js (
https://example.com/how-to-start-investing<- no investing folder in URL)
- how-to-start-investing.js (
- devops (subfolder)
- how-to-upgrade-ubuntu.js ([
https://example.com/how-to-upgrade-ubuntu<- no devops folder in URL)
- how-to-upgrade-ubuntu.js ([
- investing (subfolder)
In Jekyll, I used Front Matter to specify a custom URL per page. In NextJS looks like I have to use rewrites, but is there any other option? Also Link component has an attribute to change the link URL, but this is just to display links with URLs.