Skip to content

Commit

Permalink
wip: test process posts
Browse files Browse the repository at this point in the history
  • Loading branch information
OzakIOne committed Feb 23, 2024
1 parent fa7ec65 commit c949c3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/docusaurus-plugin-content-blog/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export default async function pluginContentBlog(
const baseBlogUrl = normalizeUrl([baseUrl, routeBasePath]);
const blogTagsListPath = normalizeUrl([baseBlogUrl, tagsBasePath]);
let blogPosts = await generateBlogPosts(contentPaths, context, options);
const listedBlogPosts = blogPosts.filter(shouldBeListed);
const processedBlogPosts = processPosts({
blogPosts,
});
Expand All @@ -122,6 +121,8 @@ export default async function pluginContentBlog(
blogPosts = processedBlogPosts;
}

const listedBlogPosts = blogPosts.filter(shouldBeListed);

if (!blogPosts.length) {
return {
blogSidebarTitle,
Expand Down
4 changes: 3 additions & 1 deletion packages/docusaurus-plugin-content-blog/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ const PluginOptionSchema = Joi.object<PluginOptions>({
sortPosts: Joi.alternatives()
.try(Joi.string().valid('descending', 'ascending'))
.default(DEFAULT_OPTIONS.sortPosts),
processPosts: Joi.function().optional().default(DEFAULT_OPTIONS.processPosts),
processPosts: Joi.function()
.optional()
.default(() => DEFAULT_OPTIONS.processPosts),
}).default(DEFAULT_OPTIONS);

export function validateOptions({
Expand Down

0 comments on commit c949c3f

Please sign in to comment.