diff --git a/components/SEO.js b/components/SEO.js index cd7d78c6..7f0cc0c2 100644 --- a/components/SEO.js +++ b/components/SEO.js @@ -247,7 +247,7 @@ const getSEOMeta = (props, router, locale) => { } case '/404': return { - title: `${siteInfo?.title} | 页面找不到啦`, + title: `${siteInfo?.title} | ${locale.NAV.PAGE_NOT_FOUND}`, image: `${siteInfo?.pageCover}` } case '/tag': diff --git a/lib/lang/en-US.js b/lib/lang/en-US.js index 1649c6d3..7229a152 100644 --- a/lib/lang/en-US.js +++ b/lib/lang/en-US.js @@ -17,7 +17,9 @@ export default { NAVIGATOR: 'NAV', ABOUT: 'About', MAIL: 'E-Mail', - ARCHIVE: 'Archive' + ARCHIVE: 'Archive', + PAGE_NOT_FOUND: 'Page Not Found', + PAGE_NOT_FOUND_REDIRECT: 'Page Not Found, Redirecting to Home Page...' }, COMMON: { THEME: 'Theme', diff --git a/lib/lang/zh-CN.js b/lib/lang/zh-CN.js index 265bb0c2..f51b6ba5 100644 --- a/lib/lang/zh-CN.js +++ b/lib/lang/zh-CN.js @@ -17,7 +17,9 @@ export default { ABOUT: '关于', NAVIGATOR: '导航', MAIL: '邮箱', - ARCHIVE: '归档' + ARCHIVE: '归档', + PAGE_NOT_FOUND: '页面找不到啦', + PAGE_NOT_FOUND_REDIRECT: '页面无法加载,即将返回首页' }, COMMON: { THEME: 'Theme', diff --git a/themes/fukasawa/index.js b/themes/fukasawa/index.js index 5553167c..4176ed11 100644 --- a/themes/fukasawa/index.js +++ b/themes/fukasawa/index.js @@ -215,6 +215,7 @@ const LayoutArchive = props => { */ const Layout404 = props => { const router = useRouter() + const { locale } = useGlobal() useEffect(() => { // 延时3秒如果加载失败就返回首页 setTimeout(() => { @@ -232,7 +233,7 @@ const Layout404 = props => {

404

-

页面无法加载,即将返回首页

+

{locale.NAV.PAGE_NOT_FOUND_REDIRECT}

diff --git a/themes/game/index.js b/themes/game/index.js index cd46246a..a2ad09e0 100644 --- a/themes/game/index.js +++ b/themes/game/index.js @@ -6,9 +6,11 @@ import NotionPage from '@/components/NotionPage' import { PWA as initialPWA } from '@/components/PWA' import ShareBar from '@/components/ShareBar' import { siteConfig } from '@/lib/config' +import { useGlobal } from '@/lib/global' import { loadWowJS } from '@/lib/plugins/wow' import { deepClone, isBrowser, shuffleArray } from '@/lib/utils' import Link from 'next/link' +import { useRouter } from 'next/router' import { createContext, useContext, useEffect, useRef, useState } from 'react' import Announcement from './components/Announcement' import { ArticleLock } from './components/ArticleLock' @@ -30,7 +32,6 @@ 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 }) @@ -354,6 +355,7 @@ const LayoutSlug = props => { */ const Layout404 = props => { const router = useRouter() + const { locale } = useGlobal() useEffect(() => { // 延时3秒如果加载失败就返回首页 setTimeout(() => { @@ -366,16 +368,21 @@ const Layout404 = props => { }, 3000) }, []) - return <> -
-
-

404

-
-

页面无法加载,即将返回首页

-
-
+ return ( + <> +
+
+

+ + 404 +

+
+

{locale.NAV.PAGE_NOT_FOUND_REDIRECT}

+
+
+ ) } /** diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js index 2da36965..13014b72 100644 --- a/themes/gitbook/index.js +++ b/themes/gitbook/index.js @@ -438,6 +438,7 @@ const LayoutArchive = props => { */ const Layout404 = props => { const router = useRouter() + const { locale } = useGlobal() useEffect(() => { // 延时3秒如果加载失败就返回首页 setTimeout(() => { @@ -455,7 +456,7 @@ const Layout404 = props => {

404

-

页面无法加载,即将返回首页

+

{locale.NAV.PAGE_NOT_FOUND_REDIRECT}