This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new 5357ef99053 (chore) build docs version decide by version.json (#330)
5357ef99053 is described below
commit 5357ef99053682cce960c201dd08374b0d582d24
Author: Jeffrey <[email protected]>
AuthorDate: Sat Oct 21 10:04:43 2023 +0800
(chore) build docs version decide by version.json (#330)
---
docusaurus.config.js | 44 +++++++++++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 17 deletions(-)
diff --git a/docusaurus.config.js b/docusaurus.config.js
index 04bc35f0b71..204aec4307c 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -3,6 +3,31 @@ const { ssrTemplate } = require('./config/ssrTemplate');
const customDocusaurusPlugin = require('./config/custom-docusaurus-plugin');
const versionsPlugin = require('./config/versions-plugin');
const lightCodeTheme = themes.dracula;
+const VERSIONS = require('./versions.json');
+
+function getDocsVersions() {
+ const result = {}
+ VERSIONS.map(version => {
+ if (version === "current") {
+ result[version] = {
+ label: 'dev',
+ path: 'dev',
+ banner: 'unreleased',
+ badge: false,
+ }
+ } else {
+ result[version] = {
+ banner: 'none',
+ badge: false,
+ }
+ }
+ })
+ return result;
+}
+
+function getLatestVersion() {
+ return VERSIONS.includes('2.0') ? '2.0' : VERSIONS[0]
+}
/** @type {import('@docusaurus/types').Config} */
const config = {
@@ -128,23 +153,8 @@ const config = {
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
- lastVersion: '2.0',
- versions: {
- 1.2: {
- banner: 'none',
- badge: false,
- },
- "2.0": {
- banner: 'none',
- badge: false,
- },
- current: {
- label: 'dev',
- path: 'dev',
- banner: 'unreleased',
- badge: false,
- },
- },
+ lastVersion: getLatestVersion(),
+ versions: getDocsVersions(),
sidebarPath: require.resolve('./sidebars.json'),
editUrl: ({ locale, versionDocsDirPath, docPath }) => {
if (versionDocsDirPath ===
'versioned_docs/version-dev') {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]