Skip to content

Commit

Permalink
fix docusaurus deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-rp committed Sep 16, 2024
1 parent 4127a6c commit a6e569e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions docs/website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,34 @@ const versions = {"current": {
noIndex: true
}}

// inject master version renaming only if versions present
let knownVersions = [];
if (fs.existsSync("versions.json")) {
knownVersions = JSON.parse(fs.readFileSync("versions.json"));
}

// inject master version renaming only if versions present and master included
if (fs.existsSync("versions.json") && "master" in knownVersions) {
let latestLabel = "latest"
if (process.env.DOCUSAURUS_DLT_VERSION) {
latestLabel = `${process.env.DOCUSAURUS_DLT_VERSION} (latest)`
}


versions["master"] = {
label: latestLabel,
path: '/'
if (knownVersions.includes("master")) {
versions["master"] = {
label: latestLabel,
path: '/'
}
}

// disable indexing for all known versions
for (let v of JSON.parse(fs.readFileSync("versions.json"))) {
for (let v of knownVersions) {
if (v == "master") {
continue;
}
versions[v] = {
noIndex: true
}
}

}

/** @type {import('@docusaurus/types').Config} */
Expand Down

0 comments on commit a6e569e

Please sign in to comment.