fix(content-blog): generate feed by reading build output (#6454)

This commit is contained in:
Joshua Chen 2022-01-26 23:54:15 +08:00 committed by GitHub
parent ebd5340205
commit 76a8d5f38a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 364 additions and 249 deletions

View file

@ -36,7 +36,6 @@ import {PluginOptionSchema} from './pluginOptionSchema';
import type {
LoadContext,
ConfigureWebpackUtils,
Props,
Plugin,
HtmlTags,
OptionValidationContext,
@ -512,14 +511,11 @@ export default async function pluginContentBlog(
};
},
async postBuild({outDir}: Props) {
async postBuild({outDir, content}) {
if (!options.feedOptions.type) {
return;
}
// TODO: we shouldn't need to re-read the posts here!
// postBuild should receive loadedContent
const blogPosts = await generateBlogPosts(contentPaths, context, options);
const {blogPosts} = content;
if (!blogPosts.length) {
return;
}