Skip to content

Commit

Permalink
docs: Fix issue in versioning docs for search
Browse files Browse the repository at this point in the history
open-policy-agent#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 <[email protected]>
  • Loading branch information
charlieegan3 authored and ashutosh-narkar committed Jan 17, 2024
1 parent 89bb42b commit b5eeaaa
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/website/layouts/partials/meta.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{{ $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 }}
{{ $description := .Param "description" }}
{{ $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 -->
Expand Down

0 comments on commit b5eeaaa

Please sign in to comment.