diff --git a/themes/hexo/LayoutSearch.js b/themes/hexo/LayoutSearch.js index b4dab8a2..0d4a7c64 100644 --- a/themes/hexo/LayoutSearch.js +++ b/themes/hexo/LayoutSearch.js @@ -21,14 +21,16 @@ export const LayoutSearch = props => { // 自动聚焦到搜索框 cRef.current.focus() if (currentSearch && !handleTextColor) { - const container = document.getElementById('container') - if (container && container.innerHTML) { - const re = new RegExp(`${currentSearch}`, 'gim') - container.innerHTML = container.innerHTML.replace( - re, + const targets = document.getElementsByClassName('replace') + for (const container of targets) { + if (container && container.innerHTML) { + const re = new RegExp(`${currentSearch}`, 'gim') + container.innerHTML = container.innerHTML.replace( + re, `${currentSearch}` - ) - handleTextColor = true + ) + handleTextColor = true + } } } }, 100) diff --git a/themes/hexo/components/BlogPostCard.js b/themes/hexo/components/BlogPostCard.js index 1937a355..1e60f68a 100644 --- a/themes/hexo/components/BlogPostCard.js +++ b/themes/hexo/components/BlogPostCard.js @@ -10,11 +10,11 @@ const BlogPostCard = ({ post, showSummary }) => { const showPreview = CONFIG_HEXO.POST_LIST_PREVIEW && post.blockMap return (
+ {(!showPreview || showSummary) &&
{post.summary}
} diff --git a/themes/hexo/components/BlogPostListPage.js b/themes/hexo/components/BlogPostListPage.js index a9ba1289..038bb322 100644 --- a/themes/hexo/components/BlogPostListPage.js +++ b/themes/hexo/components/BlogPostListPage.js @@ -13,6 +13,7 @@ import BlogPostListEmpty from './BlogPostListEmpty' */ const BlogPostListPage = ({ page = 1, posts = [], postCount }) => { const totalPage = Math.ceil(postCount / BLOG.POSTS_PER_PAGE) + const showPagination = posts.length === BLOG.POSTS_PER_PAGE if (!posts || posts.length === 0) { return