diff --git a/lib/notion/getAllPageIds.js b/lib/notion/getAllPageIds.js
index b4428df7..6d606d9a 100644
--- a/lib/notion/getAllPageIds.js
+++ b/lib/notion/getAllPageIds.js
@@ -13,7 +13,8 @@ export default function getAllPageIds (collectionQuery, collectionId, collection
}
}
} catch (error) {
-
+ console.error('Error fetching page IDs:', error);
+ return [];
}
// 否则按照数据库原始排序
diff --git a/themes/example/index.js b/themes/example/index.js
index 90580a24..c2f4518a 100644
--- a/themes/example/index.js
+++ b/themes/example/index.js
@@ -196,7 +196,29 @@ const LayoutSlug = props => {
* @returns
*/
const Layout404 = props => {
- return <>404 Not found.>
+ const router = useRouter()
+ useEffect(() => {
+ // 延时3秒如果加载失败就返回首页
+ setTimeout(() => {
+ const article = isBrowser && document.getElementById('article-wrapper')
+ if (!article) {
+ router.push('/').then(() => {
+ // console.log('找不到页面', router.asPath)
+ })
+ }
+ }, 3000)
+ }, [])
+
+ return <>
+
+
+
404
+
+
页面无法加载,即将返回首页
+
+
+
+ >
}
/**
diff --git a/themes/fukasawa/index.js b/themes/fukasawa/index.js
index 96936df8..46348127 100644
--- a/themes/fukasawa/index.js
+++ b/themes/fukasawa/index.js
@@ -213,7 +213,29 @@ const LayoutArchive = props => {
* @returns
*/
const Layout404 = props => {
- return <>404>
+ const router = useRouter()
+ useEffect(() => {
+ // 延时3秒如果加载失败就返回首页
+ setTimeout(() => {
+ const article = isBrowser && document.getElementById('article-wrapper')
+ if (!article) {
+ router.push('/').then(() => {
+ // console.log('找不到页面', router.asPath)
+ })
+ }
+ }, 3000)
+ }, [])
+
+ return <>
+
+
+
404
+
+
页面无法加载,即将返回首页
+
+
+
+ >
}
/**
diff --git a/themes/game/index.js b/themes/game/index.js
index cb0fc1a5..33880e48 100644
--- a/themes/game/index.js
+++ b/themes/game/index.js
@@ -30,6 +30,7 @@ import SideBarContent from './components/SideBarContent'
import SideBarDrawer from './components/SideBarDrawer'
import CONFIG from './config'
import { Style } from './style'
+import { useRouter } from 'next/router'
// const AlgoliaSearchModal = dynamic(() => import('@/components/AlgoliaSearchModal'), { ssr: false })
@@ -346,7 +347,29 @@ const LayoutSlug = props => {
* @returns
*/
const Layout404 = props => {
- return <>404 Not found.>
+ const router = useRouter()
+ useEffect(() => {
+ // 延时3秒如果加载失败就返回首页
+ setTimeout(() => {
+ const article = isBrowser && document.getElementById('article-wrapper')
+ if (!article) {
+ router.push('/').then(() => {
+ // console.log('找不到页面', router.asPath)
+ })
+ }
+ }, 3000)
+ }, [])
+
+ return <>
+
+
+
404
+
+
页面无法加载,即将返回首页
+
+
+
+ >
}
/**
diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js
index 5d4255e1..fde461d6 100644
--- a/themes/gitbook/index.js
+++ b/themes/gitbook/index.js
@@ -404,14 +404,34 @@ const LayoutArchive = props => {
}
/**
- * 404
+ * 404 页面
+ * @param {*} props
+ * @returns
*/
const Layout404 = props => {
- return (
-
- 404 Not found.
-
- )
+ const router = useRouter()
+ useEffect(() => {
+ // 延时3秒如果加载失败就返回首页
+ setTimeout(() => {
+ const article = isBrowser && document.getElementById('article-wrapper')
+ if (!article) {
+ router.push('/').then(() => {
+ // console.log('找不到页面', router.asPath)
+ })
+ }
+ }, 3000)
+ }, [])
+
+ return <>
+
+
+
404
+
+
页面无法加载,即将返回首页
+
+
+
+ >
}
/**
diff --git a/themes/medium/index.js b/themes/medium/index.js
index e35cdc28..0518cb9f 100644
--- a/themes/medium/index.js
+++ b/themes/medium/index.js
@@ -290,9 +290,34 @@ const LayoutArchive = props => {
* @returns
*/
const Layout404 = props => {
- return <>
- 404 Not found.
+ const router = useRouter()
+ useEffect(() => {
+ // 延时3秒如果加载失败就返回首页
+ setTimeout(() => {
+ const article =
+ typeof document !== 'undefined' &&
+ document.getElementById('notion-article')
+ if (!article) {
+ router.push('/').then(() => {
+ // console.log('找不到页面', router.asPath)
+ })
+ }
+ }, 3000)
+ })
+ return (
+ <>
+
>
+ )
}
/**
diff --git a/themes/nav/index.js b/themes/nav/index.js
index 4a9bd724..8619cf4d 100755
--- a/themes/nav/index.js
+++ b/themes/nav/index.js
@@ -360,15 +360,33 @@ const LayoutArchive = props => {
/**
* 404
+ * @param {*} props
+ * @returns
*/
const Layout404 = props => {
- return (
- <>
-
- 404 Not found.
-
+ const router = useRouter()
+ useEffect(() => {
+ // 延时3秒如果加载失败就返回首页
+ setTimeout(() => {
+ const article = isBrowser && document.getElementById('article-wrapper')
+ if (!article) {
+ router.push('/').then(() => {
+ // console.log('找不到页面', router.asPath)
+ })
+ }
+ }, 3000)
+ }, [])
+
+ return <>
+
+
+
404
+
+
页面无法加载,即将返回首页
+
+
+
>
- )
}
/**
diff --git a/themes/nobelium/index.js b/themes/nobelium/index.js
index 1dc51210..2d5fb94d 100644
--- a/themes/nobelium/index.js
+++ b/themes/nobelium/index.js
@@ -241,9 +241,29 @@ const LayoutSlug = props => {
* @param {*} props
* @returns
*/
-const Layout404 = (props) => {
+const Layout404 = props => {
+ const router = useRouter()
+ useEffect(() => {
+ // 延时3秒如果加载失败就返回首页
+ setTimeout(() => {
+ const article = isBrowser && document.getElementById('article-wrapper')
+ if (!article) {
+ router.push('/').then(() => {
+ // console.log('找不到页面', router.asPath)
+ })
+ }
+ }, 3000)
+ }, [])
+
return <>
- 404 Not found.
+
+
+
404
+
+
页面无法加载,即将返回首页
+
+
+
>
}
diff --git a/themes/plog/index.js b/themes/plog/index.js
index 2bb9b610..8d826581 100644
--- a/themes/plog/index.js
+++ b/themes/plog/index.js
@@ -204,9 +204,29 @@ const LayoutSlug = props => {
* @param {*} props
* @returns
*/
-const Layout404 = (props) => {
+const Layout404 = props => {
+ const router = useRouter()
+ useEffect(() => {
+ // 延时3秒如果加载失败就返回首页
+ setTimeout(() => {
+ const article = isBrowser && document.getElementById('article-wrapper')
+ if (!article) {
+ router.push('/').then(() => {
+ // console.log('找不到页面', router.asPath)
+ })
+ }
+ }, 3000)
+ }, [])
+
return <>
- 404 Not found.
+
+
+
404
+
+
页面无法加载,即将返回首页
+
+
+
>
}
diff --git a/themes/starter/components/MessageForm.js b/themes/starter/components/MessageForm.js
index 25bce6eb..7e03b466 100644
--- a/themes/starter/components/MessageForm.js
+++ b/themes/starter/components/MessageForm.js
@@ -24,26 +24,6 @@ export const MessageForm = () => {
}))
}
- // useEffect(() => {
- // const form = formRef.current
- // const handleSubmit = (e) => {
- // e.preventDefault()
- // submitComments(formData).then(response => {
- // console.log('Subscription succeeded:', response)
- // // 在此处添加成功订阅后的操作
- // setSuccess(true)
- // })
- // .catch(error => {
- // console.error('Subscription failed:', error)
- // // 在此处添加订阅失败后的操作
- // })
- // }
- // form?.addEventListener('submit', handleSubmit)
- // return () => {
- // form?.removeEventListener('submit', handleSubmit)
- // }
- // }, [submitComments])
-
return <>