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 412366e1..4834039b 100644
--- a/themes/example/index.js
+++ b/themes/example/index.js
@@ -199,7 +199,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 Not found.
+
>
)
diff --git a/themes/nav/index.js b/themes/nav/index.js
index 691c369a..f2316aed 100755
--- a/themes/nav/index.js
+++ b/themes/nav/index.js
@@ -363,15 +363,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 47f2f205..4455dd96 100644
--- a/themes/nobelium/index.js
+++ b/themes/nobelium/index.js
@@ -267,7 +267,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/plog/index.js b/themes/plog/index.js
index 88f4054b..3c9c7d62 100644
--- a/themes/plog/index.js
+++ b/themes/plog/index.js
@@ -222,7 +222,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/starter/components/MessageForm.js b/themes/starter/components/MessageForm.js
index 718cfcd1..47d8af09 100644
--- a/themes/starter/components/MessageForm.js
+++ b/themes/starter/components/MessageForm.js
@@ -23,26 +23,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 (
<>