Next.js Discord

Discord Forum

How to get an array of the static pages in the app?

Unanswered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
Is there a canonical way to get all the urls in a nextjs app? I realize that I'll have to come up with a solution for [slug] pages (i.e. call 'getStaticPaths' to get the dynamically generated paths) but is it possible to get an array of the "normal" pages that have their own js files under the /pages folder? I'm creating a custom sitemap if that helps.

5 Replies

Masai LionOP
sweet - thanks. I'm switching to using the filessytem directly. When I parse the pages directory, do you know how I could call getStaticPaths on the files I find?