From f477e7ff7f1dfde068304e4e208acc12c218904e Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 2 Nov 2022 11:42:50 +0100 Subject: [PATCH] docs/website: make "outdated version" banner red if ancient (#5339) Where "ancient" means it's not among the latest five releases. Also, in, netlify.toml: declare framework for dev. I've found that adding this live means I can use netlify dev --offline without any further switches. For some reason, I had run into trouble with "cecil" when using it like that. Signed-off-by: Stephan Renatus --- .../layouts/partials/docs/article.html | 15 ++++++++++--- .../partials/docs/dashboard-panel.html | 22 +++++++++++++------ netlify.toml | 1 + 3 files changed, 28 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 }}