fix(v2): handle non existent blog, docs, pages (#1459)

* fix(v2): handle non existent blog, docs, pages

* nits
This commit is contained in:
Endi 2019-05-15 13:55:07 +07:00 committed by GitHub
parent f84abfe2d1
commit 55d7920825
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 12 deletions

View file

@ -56,6 +56,10 @@ class DocusaurusPluginContentBlog {
const {siteConfig} = this.context;
const blogDir = this.contentPath;
if (!fs.existsSync(blogDir)) {
return null;
}
const {baseUrl} = siteConfig;
const blogFiles = await globby(include, {
cwd: blogDir,
@ -158,6 +162,10 @@ class DocusaurusPluginContentBlog {
}
async contentLoaded({content: blogContents, actions}) {
if (!blogContents) {
return;
}
const {
blogListComponent,
blogPostComponent,