mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
docs: Fix issue in versioning docs for search
https://github.com/open-policy-agent/opa/pull/6526 contained two errors, that I can see. First, it used `Permalink` rather than `RelPermalink`, this contains the host and scheme on build and so the older versions of pages were all getting version set to the latest. Even if that had worked, the setting of version was incorrect and set a locally scoped var instead of the variable for the whole file. Signed-off-by: Charlie Egan <charlie@styra.com>
This commit is contained in:
committed by
Ashutosh Narkar
parent
89bb42b6a7
commit
b5eeaaa2e3
@@ -1,3 +1,7 @@
|
||||
{{ $version := "latest" }}
|
||||
{{ if strings.HasPrefix .RelPermalink "/docs/" }}
|
||||
{{ $version = index (split .File.Path "/") 1 -}}
|
||||
{{ end -}}
|
||||
{{ $isHome := .IsHome }}
|
||||
{{ $isDoc := eq .Section "docs" }}
|
||||
{{ $title := cond $isHome site.Title .Title }}
|
||||
@@ -5,14 +9,10 @@
|
||||
{{ $pageType := cond $isHome "website" "article" }}
|
||||
{{ $imageUrl := "/img/logos/opa-horizontal-color.png" | absURL }}
|
||||
{{ $twitter := site.Params.social.twitter }}
|
||||
{{ $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 }}
|
||||
{{ $isLatest := or (eq $version $latest) (eq $version "latest") }}
|
||||
{{ $page := trim .RelPermalink "/" }}
|
||||
{{ $releases := site.Data.releases }}
|
||||
{{ $latest := index $releases 1 }}
|
||||
{{ $isLatest := or (eq $version $latest) (eq $version "latest") }}
|
||||
|
||||
|
||||
<!-- Basic metadata -->
|
||||
|
||||
Reference in New Issue
Block a user