From b6ba66c78c3a44f96b6841c6ac2ba0f71baa7214 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 16 Sep 2024 12:39:03 +0200 Subject: [PATCH] fix docusaurus deployment --- docs/website/docusaurus.config.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/website/docusaurus.config.js b/docs/website/docusaurus.config.js index b3cda4f7b2..355af81ad7 100644 --- a/docs/website/docusaurus.config.js +++ b/docs/website/docusaurus.config.js @@ -14,20 +14,27 @@ 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 ("master" in knownVersions) { + 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; } @@ -35,7 +42,6 @@ if (fs.existsSync("versions.json")) { noIndex: true } } - } /** @type {import('@docusaurus/types').Config} */