diff --git a/web/src/components/Installation/index.tsx b/web/src/components/Installation/index.tsx index 9bf8fca..b2223c4 100644 --- a/web/src/components/Installation/index.tsx +++ b/web/src/components/Installation/index.tsx @@ -1,15 +1,21 @@ import {ReactElement} from 'react'; import CodeBlock from '@theme/CodeBlock'; +import {useActiveVersion} from '@docusaurus/plugin-content-docs/client'; import {useCurrentVersion} from '@site/src/hooks/versions'; -// InstallationSnippet is the kubectl incantation to install the lastest -// available version of the Barman Cloud Plugin. +// InstallationSnippet is the kubectl incantation to install the Barman +// Cloud Plugin: the manifest matching the doc version being viewed, or +// (on the unreleased "current" docs) the latest manifest on main. export function InstallationSnippet(): ReactElement { - const latest = useCurrentVersion('latest'); + const activeVersion = useActiveVersion('default'); + const version = useCurrentVersion('latest'); + const url = activeVersion?.name === 'current' + ? 'https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml' + : `https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v${version}/manifest.yaml`; return ( {`kubectl apply -f \\ - https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v${latest}/manifest.yaml`} + ${url}`} ); }