Right now, I am utilizing getStaticProps
and getStaticPaths
to pre-render a specific number of articles before my website goes live. This method works effectively, but if a new article is created and displayed on the front page while the site is still active, the new article ends up displaying a 404 error page.
What I really want is for non-existent pages to pass their id (such as mysite.com/posts/id in the /posts/[id].js
file) to a function that would allow the page to be dynamically pre-rendered on the server during runtime. I do not wish to resort to using getServerSideProps
, since that would mean rendering the page with each request. Instead, I am seeking a way to permanently render the page and save it as an SEO-friendly file similar to how getStaticProps
operates, but within the runtime environment.
In simpler terms, I am searching for a behavior similar to getStaticPaths
/getStaticProps
but applicable during runtime in NextJS.
If this is not achievable, I am wondering how I can ensure that newly created articles are readily accessible without needing to intermittently bring down the server, rebuild it, and restart it - a process that appears quite unmanageable.