From dd9cdcca2016d970b3e497cdeebc0b1efeed2ca7 Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Thu, 15 Jun 2023 16:34:02 +0200 Subject: [PATCH] Ensure pre-releases are not the latest docs version --- website/docusaurus.config.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 3fc8ff528a..dcfafb44fd 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -23,6 +23,15 @@ const ArchivedVersionsDropdownItems = Object.entries(VersionsArchived).splice( 5, ); +function getLastVersion() { + const isPrerelease = (version) => + version.includes('alpha') || + version.includes('beta') || + version.includes('rc'); + const firstStableVersion = versions.find((version) => !isPrerelease(version)); + return firstStableVersion ?? versions[0]; +} + // This probably only makes sense for the alpha/beta/rc phase, temporary function getNextVersionName() { return 'Canary'; @@ -362,7 +371,7 @@ module.exports = async function createConfigAsync() { lastVersion: isDev || isDeployPreview || isBranchDeploy ? 'current' - : undefined, + : getLastVersion(), onlyIncludeVersions: (() => { if (isBuildFast) {