mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-29 17:07:08 +02:00
feat(v2): support custom description for blog-only mode (#2359)
* feat: support custom description on blog page resolve conflicts * feat(v2): allow additional props to pass to route components resolve conflicts * Update blogDescription feature * Update doc for blogDescription * Remove test blogDescription config * Fix blogDescription schema validation * Fix minor errors Co-authored-by: Xuqian <zxuqian@163.com>
This commit is contained in:
parent
1db3fbb564
commit
4af25cd597
6 changed files with 32 additions and 3 deletions
|
@ -133,6 +133,7 @@ export default function pluginContentBlog(
|
|||
page < numberOfPages - 1
|
||||
? blogPaginationPermalink(page + 1)
|
||||
: null,
|
||||
blogDescription: options.blogDescription,
|
||||
},
|
||||
items: blogPosts
|
||||
.slice(page * postsPerPage, (page + 1) * postsPerPage)
|
||||
|
|
|
@ -20,6 +20,7 @@ export const DEFAULT_OPTIONS = {
|
|||
blogTagsListComponent: '@theme/BlogTagsListPage',
|
||||
blogPostComponent: '@theme/BlogPostPage',
|
||||
blogListComponent: '@theme/BlogListPage',
|
||||
blogDescription: 'Blog',
|
||||
postsPerPage: 10,
|
||||
include: ['*.md', '*.mdx'],
|
||||
routeBasePath: 'blog',
|
||||
|
@ -42,6 +43,9 @@ export const PluginOptionSchema = Joi.object({
|
|||
blogTagsPostsComponent: Joi.string().default(
|
||||
DEFAULT_OPTIONS.blogTagsPostsComponent,
|
||||
),
|
||||
blogDescription: Joi.string()
|
||||
.allow('')
|
||||
.default(DEFAULT_OPTIONS.blogDescription),
|
||||
showReadingTime: Joi.bool().default(DEFAULT_OPTIONS.showReadingTime),
|
||||
remarkPlugins: Joi.array()
|
||||
.items(
|
||||
|
|
|
@ -29,6 +29,7 @@ export interface PluginOptions {
|
|||
blogPostComponent: string;
|
||||
blogTagsListComponent: string;
|
||||
blogTagsPostsComponent: string;
|
||||
blogDescription: string;
|
||||
remarkPlugins: ([Function, object] | Function)[];
|
||||
rehypePlugins: string[];
|
||||
truncateMarker: RegExp;
|
||||
|
@ -67,6 +68,7 @@ export interface BlogPaginatedMetadata {
|
|||
totalCount: number;
|
||||
previousPage: string | null;
|
||||
nextPage: string | null;
|
||||
blogDescription: string;
|
||||
}
|
||||
|
||||
export interface BlogPaginated {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue