Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/pages/blog/[slug].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,14 @@ export async function getStaticProps(context) {
revalidate: 3_600,
});

/**
* An empty response is not proof the post is gone. A failed query returns
* the same shape, so a `notFound` without `revalidate` pins a one year
* `s-maxage` on what may be a transient upstream failure. Re-check on a
* short interval instead.
*/
if (!props?.props?.data?.post) {
return { props: {}, notFound: true };
return { notFound: true, revalidate: 300 };
}

return props;
Expand Down
Loading