mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
Skip processing any docs with empty/no front matter instead of throwing error
This commit is contained in:
parent
68395bbe3c
commit
2585dfa1f9
2 changed files with 9 additions and 0 deletions
|
@ -60,6 +60,9 @@ function extractMetadata(content) {
|
|||
|
||||
function processMetadata(file) {
|
||||
const result = extractMetadata(fs.readFileSync(file, "utf8"));
|
||||
if (!result.metadata || !result.rawContent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const regexSubFolder = /docs\/(.*)\/.*/;
|
||||
|
||||
|
@ -120,6 +123,9 @@ function generateDocsMetadata() {
|
|||
|
||||
if (extension === ".md" || extension === ".markdown") {
|
||||
const res = processMetadata(file);
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
const metadata = res.metadata;
|
||||
metadatas.push(metadata);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue