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 <charlie@styra.com>
This commit is contained in:
Charlie Egan
2024-01-16 10:06:30 +00:00
committed by Ashutosh Narkar
parent 2dbacae1aa
commit 89bb42b6a7
+4 -1
View File
@@ -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 }}