docs(web): use active doc version for install manifest link

The install snippet always linked to the manifest of the latest
released version, regardless of which versioned docs page it was
rendered on. Viewing the 0.13.0 installation page therefore pointed
at the 0.14.0 manifest.

Fall back to the latest released version only when there is no
active version, or the active version is the unreleased "current"
docs.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
This commit is contained in:
Marco Nenciarini 2026-08-25 12:23:09 +02:00
parent 77118ed413
commit cc180de661
No known key found for this signature in database
GPG Key ID: 589F03F01BA55038
2 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import {useCurrentVersion} from '@site/src/hooks/versions';
// InstallationSnippet is the kubectl incantation to install the lastest // InstallationSnippet is the kubectl incantation to install the lastest
// available version of the Barman Cloud Plugin. // available version of the Barman Cloud Plugin.
export function InstallationSnippet(): ReactElement<null> { export function InstallationSnippet(): ReactElement<null> {
const latest = useCurrentVersion('latestReleased'); const latest = useCurrentVersion('latest');
return ( return (
<CodeBlock language="sh"> <CodeBlock language="sh">
{`kubectl apply -f \\ {`kubectl apply -f \\
@ -13,4 +13,3 @@ export function InstallationSnippet(): ReactElement<null> {
</CodeBlock> </CodeBlock>
); );
} }

View File

@ -7,7 +7,10 @@ export function useCurrentVersion(fallback: 'latest' | 'latestReleased' = 'lates
return useLatestReleasedVersion(); return useLatestReleasedVersion();
case 'latest': { case 'latest': {
const version = useActiveVersion('default'); const version = useActiveVersion('default');
return version?.name ?? useLatestVersion('default')?.name; if (version && version.name !== 'current') {
return version.name;
}
return useLatestReleasedVersion();
} }
default: default:
// The following line ensures that if `fallback` is not 'latest' or 'latestReleased', // The following line ensures that if `fallback` is not 'latest' or 'latestReleased',