mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-01 07:49:43 +02:00
fix(v2): handle non existent blog, docs, pages (#1459)
* fix(v2): handle non existent blog, docs, pages * nits
This commit is contained in:
parent
f84abfe2d1
commit
55d7920825
5 changed files with 41 additions and 12 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
const globby = require('globby');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const {encodePath, fileToPath, docuHash} = require('@docusaurus/utils');
|
||||
|
||||
const DEFAULT_OPTIONS = {
|
||||
|
@ -39,6 +40,10 @@ class DocusaurusPluginContentPages {
|
|||
const {siteConfig} = this.context;
|
||||
const pagesDir = this.contentPath;
|
||||
|
||||
if (!fs.existsSync(pagesDir)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const {baseUrl} = siteConfig;
|
||||
const pagesFiles = await globby(include, {
|
||||
cwd: pagesDir,
|
||||
|
@ -64,6 +69,10 @@ class DocusaurusPluginContentPages {
|
|||
}
|
||||
|
||||
async contentLoaded({content, actions}) {
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {addRoute, createData} = actions;
|
||||
|
||||
await Promise.all(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue