feat: add ability to mark versions as hidden

We want to continue serving the v2.0-preview content (there are a
lot of links to it floating around out there), but it is very
confusing to see it in the drop down. This commit marks the v2.0-preview
version as hidden from the version drop down selector, while still
serving them in the case someone uses the direct URL.

Signed-off-by: Jared Watts <jbw976@gmail.com>
This commit is contained in:
Jared Watts 2025-09-03 12:20:06 -07:00
parent 84131c1ffb
commit b63d34e6a0
No known key found for this signature in database
GPG Key ID: 0467EEAE3B6EC0D2
2 changed files with 13 additions and 9 deletions

View File

@ -3,6 +3,7 @@ title: "Welcome"
weight: -1
cascade:
version: "2.0-preview"
hidden: true
---
Welcome to the Crossplane documentation. Crossplane is a control plane framework

View File

@ -6,15 +6,18 @@
<!-- get all the versions and break out semver order -->
{{ range .Site.Sections }}
{{ if eq .Page.Params.version "master" }}
{{$sorted_list = $sorted_list | append "master" }}
{{ else if ne .Page.Params.version nil }}
{{ $splitver := split .Page.Params.version "." }}
{{ if eq (len $splitver) 2 }}
{{ $verlist := (index $majordict (index $splitver 0)) }}
{{ $verlist = $verlist | append (index $splitver 1) }}
{{ $majordict = merge $majordict (dict (index $splitver 0) $verlist) }}
{{ $majorlist = $majorlist | append (index $splitver 0) }}
{{/* Skip versions marked as hidden */}}
{{ if not .Page.Params.hidden }}
{{ if eq .Page.Params.version "master" }}
{{$sorted_list = $sorted_list | append "master" }}
{{ else if ne .Page.Params.version nil }}
{{ $splitver := split .Page.Params.version "." }}
{{ if eq (len $splitver) 2 }}
{{ $verlist := (index $majordict (index $splitver 0)) }}
{{ $verlist = $verlist | append (index $splitver 1) }}
{{ $majordict = merge $majordict (dict (index $splitver 0) $verlist) }}
{{ $majorlist = $majorlist | append (index $splitver 0) }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}