diff --git a/themes/heo/components/LatestPostsGroup.js b/themes/heo/components/LatestPostsGroup.js index 22ac3e42..80f0363f 100644 --- a/themes/heo/components/LatestPostsGroup.js +++ b/themes/heo/components/LatestPostsGroup.js @@ -1,8 +1,6 @@ import BLOG from '@/blog.config' -import { useGlobal } from '@/lib/global' // import Image from 'next/image' import Link from 'next/link' -import { useRouter } from 'next/router' /** * 最新文章列表 @@ -12,61 +10,41 @@ import { useRouter } from 'next/router' */ const LatestPostsGroup = ({ latestPosts, siteInfo }) => { // 获取当前路径 - const currentPath = useRouter().asPath - const { locale } = useGlobal() if (!latestPosts) { return <> } - return <> -
-
- - {locale.COMMON.LATEST_POSTS} -
-
+ return
{latestPosts.map(post => { - const selected = currentPath === `${BLOG.SUB_PATH}/${post.slug}` - const headerImage = post?.pageCoverThumbnail ? post.pageCoverThumbnail : siteInfo?.pageCover return ( - ( -
- {/* {post.title} */} - {/* eslint-disable-next-line @next/next/no-img-element */} - + className={'my-3 flex flex-col w-full'}> + +
+ {/* eslint-disable-next-line @next/next/no-img-element */} +
+
-
-
{post.title}
-
{post.lastEditedTime}
-
+ +
{post.title}
+
) ) })} - +
} export default LatestPostsGroup diff --git a/themes/heo/index.js b/themes/heo/index.js index c9e3152e..795d6ea0 100644 --- a/themes/heo/index.js +++ b/themes/heo/index.js @@ -31,6 +31,7 @@ import { Transition } from '@headlessui/react' import { Style } from './style' import { NoticeBar } from './components/NoticeBar' import { HashTag } from '@/components/HeroIcons' +import LatestPostsGroup from './components/LatestPostsGroup' /** * 基础布局 采用上中下布局,移动端使用顶部侧边导航栏 @@ -128,14 +129,15 @@ const LayoutIndex = (props) => { const LayoutPostList = (props) => { // 右侧栏 const slotRight = + const headerSlot =
+ {/* 顶部导航 */} + +
- return + return {/* 文章分类条 */} - - {BLOG.POST_LIST_STYLE === 'page' - ? - : } + {BLOG.POST_LIST_STYLE === 'page' ? : } } @@ -262,33 +264,63 @@ const LayoutSlug = props => { * @returns */ const Layout404 = props => { - const router = useRouter() - useEffect(() => { - // 延时3秒如果加载失败就返回首页 - setTimeout(() => { - if (isBrowser()) { - const article = document.getElementById('notion-article') - if (!article) { - router.push('/').then(() => { - // console.log('找不到页面', router.asPath) - }) - } - } - }, 3000) - }) + const { meta, siteInfo } = props + const { onLoading } = useGlobal() return ( - -
-
-

- 404 -

-
-

页面未找到

-
+
+ {/* 网页SEO */} + +