diff --git a/pages/category/[category]/index.js b/pages/category/[category]/index.js index 1d062b0d..eaf8436a 100644 --- a/pages/category/[category]/index.js +++ b/pages/category/[category]/index.js @@ -43,7 +43,7 @@ export async function getStaticProps({ params: { category } }) { if (BLOG.POST_LIST_STYLE === 'scroll') { // 滚动列表 给前端返回所有数据 } else if (BLOG.POST_LIST_STYLE === 'page') { - props.posts = props.posts?.slice(0, BLOG.POSTS_PER_PAGE - 1) + props.posts = props.posts?.slice(0, BLOG.POSTS_PER_PAGE) } delete props.allPages diff --git a/pages/category/[category]/page/[page].js b/pages/category/[category]/page/[page].js index 292a3146..06b66a21 100644 --- a/pages/category/[category]/page/[page].js +++ b/pages/category/[category]/page/[page].js @@ -38,7 +38,7 @@ export async function getStaticProps({ params: { category, page } }) { // 处理文章页数 props.postCount = props.posts.length // 处理分页 - props.posts = props.posts.slice(BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page - 1) + props.posts = props.posts.slice(BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page) delete props.allPages props.page = page diff --git a/pages/search/[keyword]/index.js b/pages/search/[keyword]/index.js index 69296070..f5616d5c 100644 --- a/pages/search/[keyword]/index.js +++ b/pages/search/[keyword]/index.js @@ -43,7 +43,7 @@ export async function getStaticProps({ params: { keyword } }) { if (BLOG.POST_LIST_STYLE === 'scroll') { // 滚动列表 给前端返回所有数据 } else if (BLOG.POST_LIST_STYLE === 'page') { - props.posts = props.posts?.slice(0, BLOG.POSTS_PER_PAGE - 1) + props.posts = props.posts?.slice(0, BLOG.POSTS_PER_PAGE) } props.keyword = keyword return { diff --git a/pages/search/[keyword]/page/[page].js b/pages/search/[keyword]/page/[page].js index 4ec2f819..1255f3c3 100644 --- a/pages/search/[keyword]/page/[page].js +++ b/pages/search/[keyword]/page/[page].js @@ -40,7 +40,7 @@ export async function getStaticProps({ params: { keyword, page } }) { props.posts = await filterByMemCache(allPosts, keyword) props.postCount = props.posts.length // 处理分页 - props.posts = props.posts.slice(BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page - 1) + props.posts = props.posts.slice(BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page) props.keyword = keyword props.page = page delete props.allPages diff --git a/pages/search/index.js b/pages/search/index.js index d90a3cf7..e8f51d32 100644 --- a/pages/search/index.js +++ b/pages/search/index.js @@ -55,8 +55,7 @@ export async function getStaticProps() { pageType: ['Post'] }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') - props.posts = allPosts + props.posts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') return { props, revalidate: parseInt(BLOG.NEXT_REVALIDATE_SECOND) diff --git a/pages/tag/[tag]/index.js b/pages/tag/[tag]/index.js index 79e18de6..593bf555 100644 --- a/pages/tag/[tag]/index.js +++ b/pages/tag/[tag]/index.js @@ -37,7 +37,7 @@ export async function getStaticProps({ params: { tag } }) { if (BLOG.POST_LIST_STYLE === 'scroll') { // 滚动列表 给前端返回所有数据 } else if (BLOG.POST_LIST_STYLE === 'page') { - props.posts = props.posts?.slice(0, BLOG.POSTS_PER_PAGE - 1) + props.posts = props.posts?.slice(0, BLOG.POSTS_PER_PAGE) } props.tag = tag diff --git a/pages/tag/[tag]/page/[page].js b/pages/tag/[tag]/page/[page].js index 2210339f..a21e46b4 100644 --- a/pages/tag/[tag]/page/[page].js +++ b/pages/tag/[tag]/page/[page].js @@ -31,7 +31,7 @@ export async function getStaticProps({ params: { tag, page } }) { // 处理文章数 props.postCount = props.posts.length // 处理分页 - props.posts = props.posts.slice(BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page - 1) + props.posts = props.posts.slice(BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page) props.tag = tag props.page = page