Getstaticpaths kesalahan setelah posting baru

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 = posts.map(({ slug }) => ({ params: { slug: `${slug}` } }))
  return {
    paths,
    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: {
      post,
    },
    revalidate: 10,
  }
}
Shirshak kandel