feat(content-blog): allow customizing blog archive component through option (#6603)

* feat(content-blog): allow customizing blog archive component through option

* fix
This commit is contained in:
Joshua Chen 2022-02-04 18:56:09 +08:00 committed by GitHub
parent 0c4dc00443
commit 3fd99ad8d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 1 deletions

View file

@ -202,6 +202,7 @@ export default async function pluginContentBlog(
blogPostComponent,
blogTagsListComponent,
blogTagsPostsComponent,
blogArchiveComponent,
routeBasePath,
archiveBasePath,
} = options;
@ -235,7 +236,7 @@ export default async function pluginContentBlog(
);
addRoute({
path: archiveUrl,
component: '@theme/BlogArchivePage',
component: blogArchiveComponent,
exact: true,
modules: {
archive: aliasedSource(archiveProp),

View file

@ -120,6 +120,7 @@ declare module '@docusaurus/plugin-content-blog' {
blogPostComponent: string;
blogTagsListComponent: string;
blogTagsPostsComponent: string;
blogArchiveComponent: string;
blogTitle: string;
blogDescription: string;
blogSidebarCount: number | 'ALL';

View file

@ -28,6 +28,7 @@ export const DEFAULT_OPTIONS: PluginOptions = {
blogTagsListComponent: '@theme/BlogTagsListPage',
blogPostComponent: '@theme/BlogPostPage',
blogListComponent: '@theme/BlogListPage',
blogArchiveComponent: '@theme/BlogArchivePage',
blogDescription: 'Blog',
blogTitle: 'Blog',
blogSidebarCount: 5,
@ -68,6 +69,9 @@ export const PluginOptionSchema = Joi.object<PluginOptions>({
blogTagsPostsComponent: Joi.string().default(
DEFAULT_OPTIONS.blogTagsPostsComponent,
),
blogArchiveComponent: Joi.string().default(
DEFAULT_OPTIONS.blogArchiveComponent,
),
blogTitle: Joi.string().allow('').default(DEFAULT_OPTIONS.blogTitle),
blogDescription: Joi.string()
.allow('')