From de638f277b2b5033110e7b19cd3dd1e0ebc2d7c0 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Fri, 15 May 2026 17:43:38 +0200 Subject: [PATCH] Add info box that the current docs are a preview, depending on branch name / PR. Signed-off-by: Felix Fontein --- hugo.yaml | 9 +++++++++ layouts/_partials/version-banner.html | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 layouts/_partials/version-banner.html diff --git a/hugo.yaml b/hugo.yaml index 7691dc4..8638bbc 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -181,6 +181,15 @@ params: icon: "fab fa-slack" desc: "Chat with other project developers" +# Allow content to retrieve the PULL_REQUEST and BRANCH environment variables. +# These are provided during Netlify builds: +# https://docs.netlify.com/build/configure-builds/environment-variables/#git-metadata +security: + funcs: + getenv: + - PULL_REQUEST + - BRANCH + # hugo module configuration module: diff --git a/layouts/_partials/version-banner.html b/layouts/_partials/version-banner.html new file mode 100644 index 0000000..9145a74 --- /dev/null +++ b/layouts/_partials/version-banner.html @@ -0,0 +1,18 @@ +{{- /* https://docs.netlify.com/build/configure-builds/environment-variables/#git-metadata */ -}} +{{- $is_pr := getenv "PULL_REQUEST" -}} +{{- $branch := getenv "BRANCH" -}} +{{- if or (ne $is_pr "true") (ne $branch "stable") -}} + {{- $color := "primary" -}} +
+

+ {{- if eq $is_pr "true" -}} + This is a preview of a Pull Request for SOPS documentation. + {{- else if eq $branch "main" -}} + This is the development version of the SOPS documentation. + {{- else -}} + This is a preview of the SOPS documentation. + {{- end }} + The documentation for the latest SOPS release can be found on getsops.io. +

+
+{{ end -}}