diff --git a/styles/globals.css b/styles/globals.css index 6035eed9..a4e86ff1 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -191,4 +191,15 @@ nav { .wl-meta > span { @apply dark:bg-gray-800 !important +} + +/* 固定两行 */ +.text-line-2 { + overflow : hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + word-wrap: break-word; + word-break: break-all; } \ No newline at end of file diff --git a/themes/hexo/components/LatestPostsGroup.js b/themes/hexo/components/LatestPostsGroup.js index 3c4a9a46..96eda369 100644 --- a/themes/hexo/components/LatestPostsGroup.js +++ b/themes/hexo/components/LatestPostsGroup.js @@ -10,12 +10,14 @@ import { useRouter } from 'next/router' * @constructor */ const LatestPostsGroup = ({ latestPosts, siteInfo }) => { - if (!latestPosts) { - return <>> - } // 获取当前路径 const currentPath = useRouter().asPath const { locale } = useGlobal() + + if (!latestPosts) { + return <>> + } + return ( <>