With Next.js' Incremental Static Regeneration (ISR), dynamic content can be statically served. Existing pages can be updated once a request is made.
Inspired by Brian Lovin's work. Check it out here!
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
You can change the regeneration frequency by changing the revalidate
value.
export async function getStaticProps(context) {
const posts = await getPosts();
const data = posts.filter(Boolean)
return {
props: {
data,
},
revalidate: 3600,
};
}
You can also change the number of posts displayed by passing an integer to getPosts
.
This project is open source and available under the MIT License