From 370da0a396fa58308ff663ebb195f409ae477f8c Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 2 Nov 2022 10:26:52 +0100 Subject: [PATCH 1/2] docs/website: make "outdated version" banner red if ancient Where "ancient" means it's not among the latest five releases. Signed-off-by: Stephan Renatus --- .../layouts/partials/docs/article.html | 15 ++++++++++--- .../partials/docs/dashboard-panel.html | 22 +++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/docs/website/layouts/partials/docs/article.html b/docs/website/layouts/partials/docs/article.html index 0d70d545a8..49b30be800 100644 --- a/docs/website/layouts/partials/docs/article.html +++ b/docs/website/layouts/partials/docs/article.html @@ -1,9 +1,18 @@ {{ $releases := site.Data.releases }} +{{ $version := index (split .File.Path "/") 1 }} {{ $latest := printf "%s" (index $releases 1) }} -{{- if eq (len site.Data.releases) 1 -}} +{{- if eq (len $releases) 1 -}} {{- $latest = "(dev preview)" -}} {{- end -}} -{{ $version := index (split .File.Path "/") 1 }} + +{{ $rank := 1 }} +{{- range $index, $ver := $releases -}} + {{- if eq $ver $version -}} + {{ $rank = $index }} + {{- end -}} +{{- end -}} +{{ $ancient := gt $rank 5 }} +
{{- if (eq $version "edge") }}
@@ -12,7 +21,7 @@
{{- else if (and (ne $version "latest") (ne $version $latest)) }} -
+
These are the docs for an older version of OPA. Latest stable release is {{ $latest }}
diff --git a/docs/website/layouts/partials/docs/dashboard-panel.html b/docs/website/layouts/partials/docs/dashboard-panel.html index 79a74109df..352519565e 100644 --- a/docs/website/layouts/partials/docs/dashboard-panel.html +++ b/docs/website/layouts/partials/docs/dashboard-panel.html @@ -5,6 +5,14 @@ {{ $version := index (split .File.Path "/") 1 }} {{ $page := trim .RelPermalink "/" }} {{ $isLatest := or (eq $version $latest) (eq $version "latest") }} + +{{ $rank := 1 }} +{{- range $index, $ver := $releases -}} + {{- if eq $ver $version -}} + {{ $rank = $index }} + {{- end -}} +{{- end -}} +{{ $ancient := gt $rank 5 }}