Based on the information provided in the extracts, it seems like you're facing an issue with static generation of your blog page at build time. When you add new blogs, the changes are not reflected immediately because the page was pre-rendered at build time.
One solution to this problem is to use Incremental Static Regeneration (ISR). With ISR, after the page is generated at build time, subsequent requests will serve the static file and in the background, Next.js will regenerate the page. This means that users will always see the page based on the latest request to the server.
To enable ISR, you can add a revalidate key to the object returned by getStaticProps. The value associated with revalidate is the number of seconds after which a page re-generation can occur.
Here's an example:
export async function getStaticProps() {
const data = await fetchData();
return {
props: {
data,
},
revalidate: 1,
};
}
In this example, if a new request comes in after 1 second from the last generated time, Next.js will use the stale (old) page, but in the background, it will regenerate the new page for future requests.
Please note that the revalidate option is not mentioned in the provided extracts, but it's a common solution for such issues in Next.js. You can find more details in the Next.js documentation (https://nextjs.org/docs/basic-features/data-fetching#incremental-static-regeneration).
If you're still having trouble, you might find it helpful to review the Next.js and Vercel documentation, or to post a question on the Next.js GitHub page.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: