Skip to content

Commit f90d93c

Browse files
authored
docs: use docs-only mode instead of having a landing page (#12)
The landing page is already cloudnative-pg.io, so we don't need another one. We ensure that the latest release is the one users get when they do not specify an exact version. Signed-off-by: Francesco Canovai <[email protected]>
1 parent 9f70e63 commit f90d93c

File tree

5 files changed

+44
-6
lines changed

5 files changed

+44
-6
lines changed

scripts/import_docs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fi
139139

140140
echo "Updating versions_config.json: version ${VERSION_DIR} banner=${BANNER}"
141141
jq --arg version "$VERSION_DIR" --arg banner "$BANNER" \
142-
'.[$version] = {"badge": true, "banner": $banner}' \
142+
'.[$version] = {"badge": true, "banner": $banner, "path": $version}' \
143143
"$VERSIONS_CONFIG" > "${VERSIONS_CONFIG}.tmp" && \
144144
mv "${VERSIONS_CONFIG}.tmp" "$VERSIONS_CONFIG"
145145

@@ -150,7 +150,7 @@ if [[ "$VERSION_DIR" == "$HIGHEST_VERSION" ]] && [[ "$IS_RC" == false ]]; then
150150
echo "Version ${VERSION_DIR} is the highest release - updating lastVersion in docusaurus.config.ts"
151151

152152
# Update lastVersion in docusaurus.config.ts
153-
sed -i.bak "s/lastVersion: '[^']*'/lastVersion: '${VERSION_DIR}'/" "$DOCUSAURUS_CONFIG" && \
153+
sed -i.bak "s/lastVersion = '[^']*'/lastVersion = '${VERSION_DIR}'/" "$DOCUSAURUS_CONFIG" && \
154154
rm "${DOCUSAURUS_CONFIG}.bak"
155155

156156
echo "Updated lastVersion to ${VERSION_DIR}"

website/docusaurus.config.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import type * as Preset from '@docusaurus/preset-classic';
66

77
const versionsConfig = require('./versions_config.json') as Record<string, import('@docusaurus/plugin-content-docs').VersionOptions>;
88

9+
const lastVersion = '1.28';
10+
911
const config: Config = {
1012
title: 'CloudNativePG',
1113
tagline: 'Run PostgreSQL.The Kubernetes way.',
@@ -47,7 +49,7 @@ const config: Config = {
4749
sidebarPath: require.resolve('./sidebars.js'),
4850
routeBasePath: '/',
4951
includeCurrentVersion: true, // Include the current version in the sidebar
50-
lastVersion: '1.28',
52+
lastVersion: lastVersion,
5153
versions: versionsConfig,
5254
},
5355
blog: false,
@@ -81,6 +83,7 @@ const config: Config = {
8183
logo: {
8284
alt: 'CloudNativePG Logo',
8385
src: 'img/hero_image.svg',
86+
href: 'https://cloudnative-pg.io',
8487
},
8588
items: [
8689
{
@@ -92,7 +95,11 @@ const config: Config = {
9295
{
9396
type: 'docsVersionDropdown',
9497
position: 'right',
95-
versions: ['current', '1.28', '1.27'],
98+
versions: Object.keys(versionsConfig).sort((a, b) => {
99+
if (a === 'current') return -1;
100+
if (b === 'current') return 1;
101+
return b.localeCompare(a, undefined, { numeric: true });
102+
}),
96103
},
97104
{
98105
href: "https://github.com/cloudnative-pg/",
@@ -159,6 +166,19 @@ const config: Config = {
159166
darkTheme: prismThemes.dracula,
160167
},
161168
} satisfies Preset.ThemeConfig,
169+
plugins: [
170+
[
171+
'@docusaurus/plugin-client-redirects',
172+
{
173+
redirects: [
174+
{
175+
to: `/${lastVersion}/`,
176+
from: '/',
177+
},
178+
],
179+
},
180+
],
181+
],
162182
};
163183

164184
export default config;

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
},
1717
"dependencies": {
1818
"@docusaurus/core": "3.9.1",
19+
"@docusaurus/plugin-client-redirects": "3.9.1",
1920
"@docusaurus/preset-classic": "3.9.1",
2021
"@easyops-cn/docusaurus-search-local": "^0.52.1",
2122
"@mdx-js/react": "^3.0.0",

website/versions_config.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
},
77
"1.27": {
88
"badge": true,
9-
"banner": "none"
9+
"banner": "none",
10+
"path": "1.27"
1011
},
1112
"1.28": {
1213
"badge": true,
13-
"banner": "none"
14+
"banner": "none",
15+
"path": "1.28"
1416
}
1517
}

website/yarn.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,6 +1809,21 @@
18091809
react-helmet-async "npm:@slorber/[email protected]"
18101810
react-loadable "npm:@docusaurus/[email protected]"
18111811

1812+
"@docusaurus/[email protected]":
1813+
version "3.9.1"
1814+
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-3.9.1.tgz#06e07487f1596c62536d50afac81535d5fe60a20"
1815+
integrity sha512-+1InCGvAnw46H+TnVqxaYlJC0qy9AY5gTMgTx2ZFryjAsImJNs3i1pEYW/iUTVbOdtWRj3E/87E4ehbBIaA1TA==
1816+
dependencies:
1817+
"@docusaurus/core" "3.9.1"
1818+
"@docusaurus/logger" "3.9.1"
1819+
"@docusaurus/utils" "3.9.1"
1820+
"@docusaurus/utils-common" "3.9.1"
1821+
"@docusaurus/utils-validation" "3.9.1"
1822+
eta "^2.2.0"
1823+
fs-extra "^11.1.1"
1824+
lodash "^4.17.21"
1825+
tslib "^2.6.0"
1826+
18121827
"@docusaurus/[email protected]":
18131828
version "3.9.1"
18141829
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.9.1.tgz#bf6619847065360d52abc5bf1da307f5ce2a19f8"

0 commit comments

Comments
 (0)