From e678bef2d1c2795acb14be52138abcdf7acc7bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=83=E9=80=90?= <2729478828@qq.com> Date: Thu, 14 May 2026 15:06:16 +0800 Subject: [PATCH] fix: avoid undefined isExport in slug routes --- pages/[prefix]/[slug]/[...suffix].js | 4 +++- pages/[prefix]/[slug]/index.js | 4 +++- pages/[prefix]/index.js | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pages/[prefix]/[slug]/[...suffix].js b/pages/[prefix]/[slug]/[...suffix].js index 59ab3d7c13b..83f244e1550 100644 --- a/pages/[prefix]/[slug]/[...suffix].js +++ b/pages/[prefix]/[slug]/[...suffix].js @@ -5,6 +5,8 @@ import { checkSlugHasMorThanTwoSlash } from '@/lib/utils/post' import Slug from '..' import { getStaticPathsBase } from '@/lib/build/staticPaths' +const isStaticExport = process.env.EXPORT === 'true' + /** * 根据notion的slug访问页面 * 解析三级以上目录 /article/2023/10/29/test @@ -49,7 +51,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 6dac4503a53..53f4cd1048d 100644 --- a/pages/[prefix]/[slug]/index.js +++ b/pages/[prefix]/[slug]/index.js @@ -5,6 +5,8 @@ import Slug from '..' import { checkSlugHasOneSlash } from '@/lib/utils/post' import { getStaticPathsBase } from '@/lib/build/staticPaths' +const isStaticExport = process.env.EXPORT === 'true' + /** * 根据notion的slug访问页面 * 解析二级目录 /article/about @@ -37,7 +39,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 612d5eaef8f..ac34aed7938 100644 --- a/pages/[prefix]/index.js +++ b/pages/[prefix]/index.js @@ -18,6 +18,8 @@ import PropTypes from 'prop-types' import { useEffect, useState } from 'react' import { getStaticPathsBase } from '@/lib/build/staticPaths' +const isStaticExport = process.env.EXPORT === 'true' + /** * 根据notion的slug访问页面 * 只解析一级目录例如 /about @@ -134,7 +136,7 @@ export async function getStaticProps({ params: { prefix }, locale }) { return { props, - revalidate: isExport() + revalidate: isStaticExport ? undefined : siteConfig( 'NEXT_REVALIDATE_SECOND',