feat(blog): allow processing blog posts through a processBlogPosts function (#9886)

Co-authored-by: OzakIOne <OzakIOne@users.noreply.github.com>
Co-authored-by: sebastien <lorber.sebastien@gmail.com>
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
This commit is contained in:
ozaki 2024-03-05 22:58:16 +01:00 committed by GitHub
parent 05279dc3d8
commit 2851c93d0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 400 additions and 6 deletions

View file

@ -51,6 +51,7 @@ export const DEFAULT_OPTIONS: PluginOptions = {
authorsMapPath: 'authors.yml',
readingTime: ({content, defaultReadingTime}) => defaultReadingTime({content}),
sortPosts: 'descending',
processBlogPosts: async () => undefined,
};
const PluginOptionSchema = Joi.object<PluginOptions>({
@ -134,6 +135,9 @@ const PluginOptionSchema = Joi.object<PluginOptions>({
sortPosts: Joi.string()
.valid('descending', 'ascending')
.default(DEFAULT_OPTIONS.sortPosts),
processBlogPosts: Joi.function()
.optional()
.default(() => DEFAULT_OPTIONS.processBlogPosts),
}).default(DEFAULT_OPTIONS);
export function validateOptions({