Hi Jeroen,
Welcome to the Prismic community.
When using getStaticProps to build your website statically with Next.js you need to be sure to use the getStaticPaths and the returned fallback
field set to true
.
In this way, you ask your next app to fetch the draft unpublished documents that has paths that have not been generated at build time as shown in this code snippet.
export async function getStaticPaths() {
const documents = await queryRepeatableDocuments(
(doc) => doc.type === 'page'
);
return {
paths: documents.map((doc) => {
return { params: { uid: doc.uid }, locale: doc.lang };
}),
fallback: false,
};
}
Also, note that when you have the fallback
field set to false
then your Next.js app will return a 404 page
Please check this article to learn more about getStaticPaths
Please let us know if that doesn't solve the issue for you.
Fares