diff --git a/web/docs/installation.md b/web/docs/installation.mdx
similarity index 88%
rename from web/docs/installation.md
rename to web/docs/installation.mdx
index 7dfa73c..bb003c0 100644
--- a/web/docs/installation.md
+++ b/web/docs/installation.mdx
@@ -6,6 +6,20 @@ sidebar_position: 20
+import { react } from 'react';
+import CodeBlock from '@theme/CodeBlock';
+import { useCurrentVersion } from '@site/src/hooks/versions';
+
+export function InstallationSnippet() {
+ const latest = useCurrentVersion('latestReleased');
+ return(
+
+ {`kubectl apply -f \\
+ https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v${latest}/manifest.yaml`}
+
+ );
+}
+
:::important
1. The plugin **must** be installed in the same namespace as the CloudNativePG
operator (typically `cnpg-system`).
@@ -59,14 +73,7 @@ Both checks are required before proceeding with the installation.
Install the plugin using `kubectl` by applying the manifest for the latest
release:
-
-
-```sh
-kubectl apply -f \
- https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v0.4.0/manifest.yaml
-```
-
-
+
Example output:
@@ -114,4 +121,3 @@ following command:
kubectl apply -f \
https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml
```
-
diff --git a/web/docs/migration.md b/web/docs/migration.md
index 3c4ba98..b91fa0d 100644
--- a/web/docs/migration.md
+++ b/web/docs/migration.md
@@ -13,7 +13,7 @@ If you're currently relying on the built-in Barman Cloud integration, you can
migrate seamlessly to the new **plugin-based architecture** using the Barman
Cloud Plugin, with **no downtime**. Follow these steps:
-- [Install the Barman Cloud Plugin](installation.md)
+- [Install the Barman Cloud Plugin](installation.mdx)
- Create an `ObjectStore` resource by translating the contents of the
`.spec.backup.barmanObjectStore` section from your existing `Cluster`
definition
diff --git a/web/docs/usage.md b/web/docs/usage.md
index 869dfe2..dcff072 100644
--- a/web/docs/usage.md
+++ b/web/docs/usage.md
@@ -6,7 +6,7 @@ sidebar_position: 30
-After [installing the plugin](installation.md) in the same namespace as the
+After [installing the plugin](installation.mdx) in the same namespace as the
CloudNativePG operator, enabling your PostgreSQL cluster to use the Barman
Cloud Plugin involves just a few steps:
diff --git a/web/src/hooks/versions.ts b/web/src/hooks/versions.ts
new file mode 100644
index 0000000..6306227
--- /dev/null
+++ b/web/src/hooks/versions.ts
@@ -0,0 +1,27 @@
+import { useActiveVersion, useLatestVersion, useVersions } from '@docusaurus/plugin-content-docs/client';
+
+
+export function useCurrentVersion(fallback: 'latest' | 'latestReleased' = 'latest') {
+ const version = useActiveVersion('default');
+ if (fallback === 'latestReleased') {
+ return useLatestReleasedVersion();
+ }
+ if (fallback === 'latest') {
+ return version?.name ?? useLatestVersion('default');
+ }
+}
+
+
+export function useLatestReleasedVersion() {
+ const versions = useVersions('default'); // returns all versions, including "current"
+
+ // Filter out "current" to only consider versioned docs
+ const versioned = versions.filter(v => v.name !== 'current');
+
+ // Assuming the latest is the first in the list after sorting by semantic version
+ const latestVersion = versioned.length > 0
+ ? versioned.sort((a, b) => (b.name.localeCompare(a.name, undefined, {numeric: true, sensitivity: 'base'})))[0]
+ : null;
+
+ return latestVersion.name
+}