Skip to content

Commit ada0fb7

Browse files
committed
docs: use docs-only mode instead of having a landing page
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 787f08b commit ada0fb7

File tree

7 files changed

+29
-146
lines changed

7 files changed

+29
-146
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: 23 additions & 3 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.',
@@ -45,9 +47,9 @@ const config: Config = {
4547
docs: {
4648
path: 'docs',
4749
sidebarPath: require.resolve('./sidebars.js'),
48-
routeBasePath: 'docs',
50+
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/src/components/HomepageFeatures/index.tsx

Lines changed: 0 additions & 68 deletions
This file was deleted.

website/src/components/HomepageFeatures/styles.module.css

Lines changed: 0 additions & 11 deletions
This file was deleted.

website/src/pages/index.module.css

Lines changed: 0 additions & 23 deletions
This file was deleted.

website/src/pages/index.tsx

Lines changed: 0 additions & 37 deletions
This file was deleted.

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
}

0 commit comments

Comments
 (0)