mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
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:
parent
0c4dc00443
commit
3fd99ad8d4
4 changed files with 8 additions and 1 deletions
|
@ -202,6 +202,7 @@ export default async function pluginContentBlog(
|
||||||
blogPostComponent,
|
blogPostComponent,
|
||||||
blogTagsListComponent,
|
blogTagsListComponent,
|
||||||
blogTagsPostsComponent,
|
blogTagsPostsComponent,
|
||||||
|
blogArchiveComponent,
|
||||||
routeBasePath,
|
routeBasePath,
|
||||||
archiveBasePath,
|
archiveBasePath,
|
||||||
} = options;
|
} = options;
|
||||||
|
@ -235,7 +236,7 @@ export default async function pluginContentBlog(
|
||||||
);
|
);
|
||||||
addRoute({
|
addRoute({
|
||||||
path: archiveUrl,
|
path: archiveUrl,
|
||||||
component: '@theme/BlogArchivePage',
|
component: blogArchiveComponent,
|
||||||
exact: true,
|
exact: true,
|
||||||
modules: {
|
modules: {
|
||||||
archive: aliasedSource(archiveProp),
|
archive: aliasedSource(archiveProp),
|
||||||
|
|
|
@ -120,6 +120,7 @@ declare module '@docusaurus/plugin-content-blog' {
|
||||||
blogPostComponent: string;
|
blogPostComponent: string;
|
||||||
blogTagsListComponent: string;
|
blogTagsListComponent: string;
|
||||||
blogTagsPostsComponent: string;
|
blogTagsPostsComponent: string;
|
||||||
|
blogArchiveComponent: string;
|
||||||
blogTitle: string;
|
blogTitle: string;
|
||||||
blogDescription: string;
|
blogDescription: string;
|
||||||
blogSidebarCount: number | 'ALL';
|
blogSidebarCount: number | 'ALL';
|
||||||
|
|
|
@ -28,6 +28,7 @@ export const DEFAULT_OPTIONS: PluginOptions = {
|
||||||
blogTagsListComponent: '@theme/BlogTagsListPage',
|
blogTagsListComponent: '@theme/BlogTagsListPage',
|
||||||
blogPostComponent: '@theme/BlogPostPage',
|
blogPostComponent: '@theme/BlogPostPage',
|
||||||
blogListComponent: '@theme/BlogListPage',
|
blogListComponent: '@theme/BlogListPage',
|
||||||
|
blogArchiveComponent: '@theme/BlogArchivePage',
|
||||||
blogDescription: 'Blog',
|
blogDescription: 'Blog',
|
||||||
blogTitle: 'Blog',
|
blogTitle: 'Blog',
|
||||||
blogSidebarCount: 5,
|
blogSidebarCount: 5,
|
||||||
|
@ -68,6 +69,9 @@ export const PluginOptionSchema = Joi.object<PluginOptions>({
|
||||||
blogTagsPostsComponent: Joi.string().default(
|
blogTagsPostsComponent: Joi.string().default(
|
||||||
DEFAULT_OPTIONS.blogTagsPostsComponent,
|
DEFAULT_OPTIONS.blogTagsPostsComponent,
|
||||||
),
|
),
|
||||||
|
blogArchiveComponent: Joi.string().default(
|
||||||
|
DEFAULT_OPTIONS.blogArchiveComponent,
|
||||||
|
),
|
||||||
blogTitle: Joi.string().allow('').default(DEFAULT_OPTIONS.blogTitle),
|
blogTitle: Joi.string().allow('').default(DEFAULT_OPTIONS.blogTitle),
|
||||||
blogDescription: Joi.string()
|
blogDescription: Joi.string()
|
||||||
.allow('')
|
.allow('')
|
||||||
|
|
|
@ -54,6 +54,7 @@ Accepted fields:
|
||||||
| `blogPostComponent` | `string` | `'@theme/BlogPostPage'` | Root component of each blog post page. |
|
| `blogPostComponent` | `string` | `'@theme/BlogPostPage'` | Root component of each blog post page. |
|
||||||
| `blogTagsListComponent` | `string` | `'@theme/BlogTagsListPage'` | Root component of the tags list page |
|
| `blogTagsListComponent` | `string` | `'@theme/BlogTagsListPage'` | Root component of the tags list page |
|
||||||
| `blogTagsPostsComponent` | `string` | `'@theme/BlogTagsPostsPage'` | Root component of the "posts containing tag" page. |
|
| `blogTagsPostsComponent` | `string` | `'@theme/BlogTagsPostsPage'` | Root component of the "posts containing tag" page. |
|
||||||
|
| `blogArchiveComponent` | `string` | `'@theme/BlogArchivePage'` | Root component of the blog archive page. |
|
||||||
| `remarkPlugins` | `any[]` | `[]` | Remark plugins passed to MDX. |
|
| `remarkPlugins` | `any[]` | `[]` | Remark plugins passed to MDX. |
|
||||||
| `rehypePlugins` | `any[]` | `[]` | Rehype plugins passed to MDX. |
|
| `rehypePlugins` | `any[]` | `[]` | Rehype plugins passed to MDX. |
|
||||||
| `beforeDefaultRemarkPlugins` | `any[]` | `[]` | Custom Remark plugins passed to MDX before the default Docusaurus Remark plugins. |
|
| `beforeDefaultRemarkPlugins` | `any[]` | `[]` | Custom Remark plugins passed to MDX before the default Docusaurus Remark plugins. |
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue