From 89bb42b6a7724d1f6122f3eb3f4e6cf41e9bd10f Mon Sep 17 00:00:00 2001 From: Charlie Egan Date: Tue, 16 Jan 2024 10:06:30 +0000 Subject: [PATCH] docs: update version for non docs pages This sets the default version for all non docs pages to latest. We have recently started to list some pages in the search index from non docs pages, when a user makes a search, they search within the current version. This will make pages from the rest of the site available in the index when searching from 'latest'. Signed-off-by: Charlie Egan --- docs/website/layouts/partials/meta.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/website/layouts/partials/meta.html b/docs/website/layouts/partials/meta.html index 3027bf32aa..34dda51f29 100644 --- a/docs/website/layouts/partials/meta.html +++ b/docs/website/layouts/partials/meta.html @@ -5,7 +5,10 @@ {{ $pageType := cond $isHome "website" "article" }} {{ $imageUrl := "/img/logos/opa-horizontal-color.png" | absURL }} {{ $twitter := site.Params.social.twitter }} -{{ $version := index (split .File.Path "/") 1 }} +{{ $version := "latest" }} +{{ if strings.HasPrefix .Permalink "/docs/" }} +{{ $version := index (split .File.Path "/") 1 }} +{{ end }} {{ $page := trim .RelPermalink "/" }} {{ $releases := site.Data.releases }} {{ $latest := index $releases 1 }}