mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 16:17:25 +02:00
Update doc metadata to use file name as id fallback and id as title fallback
This commit is contained in:
parent
db7a7394b3
commit
964e9e2108
5 changed files with 56 additions and 27 deletions
|
@ -60,6 +60,10 @@ function splitHeader(content) {
|
|||
function extractMetadata(content) {
|
||||
const metadata = {};
|
||||
const both = splitHeader(content);
|
||||
// if no content returned, then that means there was no header, and both.header is the content
|
||||
if (!both.content) {
|
||||
return { metadata, rawContent: both.header };
|
||||
}
|
||||
const lines = both.header.split("\n");
|
||||
for (let i = 0; i < lines.length - 1; ++i) {
|
||||
const keyvalue = lines[i].split(":");
|
||||
|
@ -265,8 +269,9 @@ function diffLatestSidebar() {
|
|||
return true;
|
||||
}
|
||||
const currentSidebar = CWD + "/sidebars.json";
|
||||
// if no current sidebar file, return false so no sidebar file gets copied
|
||||
if (!fs.existsSync(currentSidebar)) {
|
||||
// TO DO: error message
|
||||
return false;
|
||||
}
|
||||
|
||||
// compare for equality between latest version sidebar with version prefixes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue