1459
This commit is contained in:
1 parent
ba7a2912e8
commit
3db86472fb
21 files changed
+921
-72
No files matched your search
@@ -76,8 +76,9 @@ export function listPosts(options?: {
|
||||
page?: number;
|
||||
perPage?: number;
|
||||
includeDrafts?: boolean;
|
||||
author?: string;
|
||||
}): { posts: PostListItem[]; total: number; totalPages: number } {
|
||||
const { search = "", page = 1, perPage = ITEMS_PER_PAGE, includeDrafts = true } = options || {};
|
||||
const { search = "", page = 1, perPage = ITEMS_PER_PAGE, includeDrafts = true, author } = options || {};
|
||||
const dirs = findPostDirectories();
|
||||
|
||||
const allPosts: PostListItem[] = [];
|
||||
@@ -102,6 +103,9 @@ export function listPosts(options?: {
|
||||
|
||||
if (!includeDrafts && post.draft) continue;
|
||||
|
||||
// 按作者过滤
|
||||
if (author && post.author !== author) continue;
|
||||
|
||||
if (search) {
|
||||
const q = search.toLowerCase();
|
||||
const match =
|
||||
|
||||
Reference in new issue
Block a user