mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-17 10:12:25 +02:00
feat(blog): authors page (#10216)
Co-authored-by: OzakIOne <OzakIOne@users.noreply.github.com> Co-authored-by: sebastien <lorber.sebastien@gmail.com> Co-authored-by: slorber <slorber@users.noreply.github.com>
This commit is contained in:
parent
50f9fce29b
commit
f356e29938
56 changed files with 1670 additions and 706 deletions
|
@ -29,11 +29,12 @@ import {
|
|||
} from '@docusaurus/utils';
|
||||
import {getTagsFile} from '@docusaurus/utils-validation';
|
||||
import {validateBlogPostFrontMatter} from './frontMatter';
|
||||
import {type AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
|
||||
import {getBlogPostAuthors} from './authors';
|
||||
import {reportAuthorsProblems} from './authorsProblems';
|
||||
import type {TagsFile} from '@docusaurus/utils';
|
||||
import type {LoadContext, ParseFrontMatter} from '@docusaurus/types';
|
||||
import type {
|
||||
AuthorsMap,
|
||||
PluginOptions,
|
||||
ReadingTimeFunction,
|
||||
BlogPost,
|
||||
|
@ -64,7 +65,7 @@ export function paginateBlogPosts({
|
|||
const totalCount = blogPosts.length;
|
||||
const postsPerPage =
|
||||
postsPerPageOption === 'ALL' ? totalCount : postsPerPageOption;
|
||||
const numberOfPages = Math.ceil(totalCount / postsPerPage);
|
||||
const numberOfPages = Math.max(1, Math.ceil(totalCount / postsPerPage));
|
||||
|
||||
const pages: BlogPaginated[] = [];
|
||||
|
||||
|
@ -366,6 +367,7 @@ export async function generateBlogPosts(
|
|||
contentPaths: BlogContentPaths,
|
||||
context: LoadContext,
|
||||
options: PluginOptions,
|
||||
authorsMap?: AuthorsMap,
|
||||
): Promise<BlogPost[]> {
|
||||
const {include, exclude} = options;
|
||||
|
||||
|
@ -378,11 +380,6 @@ export async function generateBlogPosts(
|
|||
ignore: exclude,
|
||||
});
|
||||
|
||||
const authorsMap = await getAuthorsMap({
|
||||
contentPaths,
|
||||
authorsMapPath: options.authorsMapPath,
|
||||
});
|
||||
|
||||
const tagsFile = await getTagsFile({contentPaths, tags: options.tags});
|
||||
|
||||
async function doProcessBlogSourceFile(blogSourceFile: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue