refactor(content-blog): clean up type definitions; in-code documentation (#6922)

* refactor(content-blog): clean up type definitions; in-code documentation

* add doc
This commit is contained in:
Joshua Chen 2022-03-16 19:36:57 +08:00 committed by GitHub
parent 46b1027c4a
commit 8d1c1954c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 509 additions and 240 deletions

View file

@ -29,11 +29,13 @@ async function generateBlogFeed({
options,
siteConfig,
outDir,
locale,
}: {
blogPosts: BlogPost[];
options: PluginOptions;
siteConfig: DocusaurusConfig;
outDir: string;
locale: string;
}): Promise<Feed | null> {
if (!blogPosts.length) {
return null;
@ -47,11 +49,11 @@ async function generateBlogFeed({
const feed = new Feed({
id: blogBaseUrl,
title: feedOptions.title || `${title} Blog`,
title: feedOptions.title ?? `${title} Blog`,
updated,
language: feedOptions.language,
language: feedOptions.language ?? locale,
link: blogBaseUrl,
description: feedOptions.description || `${siteConfig.title} Blog`,
description: feedOptions.description ?? `${siteConfig.title} Blog`,
favicon: favicon ? normalizeUrl([siteUrl, baseUrl, favicon]) : undefined,
copyright: feedOptions.copyright,
});
@ -140,17 +142,20 @@ export async function createBlogFeedFiles({
options,
siteConfig,
outDir,
locale,
}: {
blogPosts: BlogPost[];
options: PluginOptions;
siteConfig: DocusaurusConfig;
outDir: string;
locale: string;
}): Promise<void> {
const feed = await generateBlogFeed({
blogPosts,
options,
siteConfig,
outDir,
locale,
});
const feedTypes = options.feedOptions.type;