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.
44 lines
727 B
TypeScript
44 lines
727 B
TypeScript
export function getStaticPaths() {
|
|
return {
|
|
paths: [
|
|
{
|
|
params: { slug: 'first' },
|
|
},
|
|
{
|
|
params: { slug: 'second' },
|
|
},
|
|
{
|
|
params: { slug: 'not-found' },
|
|
},
|
|
],
|
|
fallback: false,
|
|
}
|
|
}
|
|
|
|
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(props) {
|
|
return (
|
|
<>
|
|
<p>/isr-pages-fallback-false</p>
|
|
<p>now: {Date.now()}</p>
|
|
<p>{JSON.stringify(props)}</p>
|
|
</>
|
|
)
|
|
}
|