I’m working on a dynamic page that supports the creation of unlimited new posts (pages) based on the CMS data model. In cases where the specific post data does not exist, I need to return a 404 page.
Here are the implementation steps I’ve taken:
In Builder, I created a dynamic page that targets all pages starting with ‘/post.’
Additionally, I created a CMS data model from which the dynamic page fetches the selected post data using custom JS.
In my Next.js app, I created a dynamic page with the ‘getStaticPaths’ fallback value set to ‘true.’
The current issue is that using ‘getStaticPaths’ and setting the fallback value to ‘blocking’ will work as I expect, but it will require me to generate a build each time new posts are added.
On the other hand, setting the ‘getStaticPaths’ value to ‘true’ will show a page even if the post IDs do not really exist, and some of the data shown may be broken.
What would be the best way to implement this?