refactor(v2): do not generate RSS files for empty feed (#4905)

This commit is contained in:
Alexey Pyltsyn 2021-06-09 14:26:53 +03:00 committed by GitHub
parent 526ce44933
commit f71e83450f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 29 deletions

View file

@ -117,6 +117,7 @@ export default function pluginContentBlog(
const {postsPerPage, routeBasePath} = options;
blogPosts = await generateBlogPosts(contentPaths, context, options);
if (!blogPosts.length) {
return null;
}
@ -506,9 +507,14 @@ export default function pluginContentBlog(
},
injectHtmlTags() {
if (!blogPosts.length) {
return {};
}
if (!options.feedOptions?.type) {
return {};
}
const feedTypes = options.feedOptions.type;
const {
siteConfig: {title},