mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 23:57:22 +02:00
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:
parent
05279dc3d8
commit
2851c93d0d
12 changed files with 400 additions and 6 deletions
|
@ -75,6 +75,7 @@ Accepted fields:
|
|||
| `feedOptions.copyright` | `string` | `undefined` | Copyright message. |
|
||||
| `feedOptions.language` | `string` (See [documentation](http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes) for possible values) | `undefined` | Language metadata of the feed. |
|
||||
| `sortPosts` | <code>'descending' \| 'ascending' </code> | `'descending'` | Governs the direction of blog post sorting. |
|
||||
| `processBlogPosts` | <code>[ProcessBlogPostsFn](#ProcessBlogPostsFn)</code> | `undefined` | An optional function which can be used to transform blog posts (filter, modify, delete, etc...). |
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
|
@ -131,6 +132,14 @@ type CreateFeedItemsFn = (params: {
|
|||
}) => Promise<BlogFeedItem[]>;
|
||||
```
|
||||
|
||||
#### `ProcessBlogPostsFn` {#ProcessBlogPostsFn}
|
||||
|
||||
```ts
|
||||
type ProcessBlogPostsFn = (params: {
|
||||
blogPosts: BlogPost[];
|
||||
}) => Promise<void | BlogPost[]>;
|
||||
```
|
||||
|
||||
### Example configuration {#ex-config}
|
||||
|
||||
You can configure this plugin through preset options or plugin options.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue