getstaticpaths errors after new posts

The solution for “getstaticpaths errors after new posts” can be found here. The following code will assist you in solving the problem.

You can also use getStaticPaths with fallback to true.
And getStaticProps with revalidate whicth triggers incremental builds basiclly.
to avoid error after build
export async function getStaticPaths() {
const res = await fetch(`${baseUrl}/wp-json/wp/v2/posts`)
const posts = await res.json()
const paths ={ slug }) => ({ params: { slug: `${slug}` } }))
return {
fallback: true,

export async function getStaticProps(context) {
const resPost = await fetch(`${baseUrl}/wp-json/wp/v2/posts?slug=${context.params.slug}`)

const post = await resPost.json()

return {
props: {
revalidate: 10,

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

inline scripts encapsulated in