Skip to content

Commit

Permalink
Only includes author with posts
Browse files Browse the repository at this point in the history
Otherwise we need to disable the default config author
  • Loading branch information
caendesilva committed Jul 12, 2024
1 parent a1c5346 commit 949dbf6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public static function generateAuthorPages(): array
// Todo: This does not find authors that have no author config, we should add those to the underlying collection!

return Hyde::authors()
// This filtering is opinionated, and we can configure it, but for now it only includes authors with posts
->filter(fn (PostAuthor $author): bool => $author->getPosts()->isNotEmpty())
->map(fn (PostAuthor $author): PostAuthorPage => new PostAuthorPage("author/$author->username"))->all();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testAuthorPagesAreGenerated()
'_posts/jane_post_2.md',
'author/mr_hyde',
'author/jane_doe',
'author/user123',
// 'author/user123',
// TODO: 'author/anonymous',
// TODO: 'author/guest',
], array_keys(Hyde::pages()->all()));
Expand Down

0 comments on commit 949dbf6

Please sign in to comment.