diff --git a/pages/[prefix]/[slug]/[...suffix].js b/pages/[prefix]/[slug]/[...suffix].js index dda24a415e4..c57d48a69fe 100644 --- a/pages/[prefix]/[slug]/[...suffix].js +++ b/pages/[prefix]/[slug]/[...suffix].js @@ -6,6 +6,8 @@ import { isExport } from '@/lib/utils/buildMode' import { checkSlugHasMorThanTwoSlash } from '@/lib/utils/post' import Slug from '..' +const isStaticExport = process.env.EXPORT === 'true' + /** * 根据notion的slug访问页面 * 解析三级以上目录 /article/2023/10/29/test @@ -50,7 +52,7 @@ export async function getStaticProps({ return { props, - revalidate: isExport() + revalidate: isStaticExport ? undefined : siteConfig( 'NEXT_REVALIDATE_SECOND', diff --git a/pages/[prefix]/[slug]/index.js b/pages/[prefix]/[slug]/index.js index 1ea684e2fe3..f24ea1a67a5 100644 --- a/pages/[prefix]/[slug]/index.js +++ b/pages/[prefix]/[slug]/index.js @@ -6,6 +6,8 @@ import { getStaticPathsBase } from '@/lib/build/staticPaths' import { isExport } from '@/lib/utils/buildMode' import { checkSlugHasOneSlash } from '@/lib/utils/post' +const isStaticExport = process.env.EXPORT === 'true' + /** * 根据notion的slug访问页面 * 解析二级目录 /article/about @@ -38,7 +40,7 @@ export async function getStaticProps({ params: { prefix, slug }, locale }) { return { props, - revalidate: isExport() + revalidate: isStaticExport ? undefined : siteConfig( 'NEXT_REVALIDATE_SECOND', diff --git a/pages/[prefix]/index.js b/pages/[prefix]/index.js index 66092c07e80..774a7916a17 100644 --- a/pages/[prefix]/index.js +++ b/pages/[prefix]/index.js @@ -19,6 +19,8 @@ import { useEffect, useState } from 'react' import { getStaticPathsBase } from '@/lib/build/staticPaths' import { isExport } from '@/lib/utils/buildMode' +const isStaticExport = process.env.EXPORT === 'true' + /** * 根据notion的slug访问页面 * 只解析一级目录例如 /about @@ -135,7 +137,7 @@ export async function getStaticProps({ params: { prefix }, locale }) { return { props, - revalidate: isExport() + revalidate: isStaticExport ? undefined : siteConfig( 'NEXT_REVALIDATE_SECOND',