mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
This handles `i18n` cases, ensures `pathname` field is prefixed with `basePath` when configured, and fixes interop with `output: 'export'` configured.
43 lines
682 B
TypeScript
43 lines
682 B
TypeScript
export function getStaticPaths() {
|
|
return {
|
|
paths: [
|
|
{
|
|
params: { slug: 'first' },
|
|
},
|
|
{
|
|
params: { slug: 'second' },
|
|
},
|
|
{
|
|
params: { slug: 'not-found' },
|
|
},
|
|
],
|
|
fallback: 'blocking',
|
|
}
|
|
}
|
|
|
|
export function getStaticProps({ params }) {
|
|
if (params.slug === 'not-found') {
|
|
return {
|
|
notFound: true,
|
|
}
|
|
}
|
|
|
|
return {
|
|
props: {
|
|
params,
|
|
now: Date.now(),
|
|
},
|
|
revalidate:
|
|
!process.env.TEST_EXPORT && params.slug === 'first' ? 60 : undefined,
|
|
}
|
|
}
|
|
|
|
export default function Page() {
|
|
return (
|
|
<>
|
|
<p>/isr-pages/[slug]</p>
|
|
<p>now: {Date.now()}</p>
|
|
</>
|
|
)
|
|
}
|