fix 仅文章状态为Published的,计算category与tags计数,Invisible的文章不参与计数

This commit is contained in:
xloong
2022-12-12 14:44:33 +08:00
parent 01bca8ae1a
commit 87da9c0dbf
2 changed files with 2 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ import { isIterable } from '../utils'
* @returns {Promise<{}|*[]>}
*/
export function getAllCategories({ allPages, categoryOptions, sliceCount = 0 }) {
const allPosts = allPages.filter(page => page.type === 'Post')
const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published')
if (!allPosts || !categoryOptions) {
return []
}

View File

@@ -8,7 +8,7 @@ import { isIterable } from '../utils'
* @returns {Promise<{}|*[]>}
*/
export function getAllTags({ allPages, sliceCount = 0, tagOptions }) {
const allPosts = allPages.filter(page => page.type === 'Post')
const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published')
if (!allPosts || !tagOptions) {
return []