Next.js beginner here, hoping for pointers on using getStaticPaths and getStaticProps with catch-all routes. Most Next.js 9.3+ blog starters seem to be based on just one level of blog posts (e.g., /posts/post-1.md, /posts/post-2.md, etc.), but what I've tried vainly to find is a starter — or just a set of instructions — that addresses handling, say, /posts/yyyy/mm/postname.md through /pages/posts/[...post].js.
I did read the Next.js docs regarding these items, of course, but I find them just a little short of helpful in at least this particular case. I do realize they're written for more experienced Next.js devs. This one item, from https://nextjs.org/docs/routing/dynamic-routes, gets me as close as I can get at the moment, but not quite far enough:
If the page name uses catch-all routes, for example
pages/[...slug], thenparamsshould containslugwhich is an array. For example, if this array is['foo', 'bar'], then Next.js will statically generate the page at/foo/bar.
I tried using fs-readdir-recursive to read the /posts/ directory's various levels and that works, but what it gives me doesn't produce the array that getStaticPaths wants. I'm sure I just need to massage the result but can't find any examples to help me figure it out. (Most examples that do go further than the one-level scenario seem to deal with fetching from DBs, perhaps because the scenario I'm trying to find is considered too simple. Probably is, for non-beginners, but...)