blob: e8c40362c5c4edf2940c8c29110ff2d6ecd10d79 [file]
{{- $p := . -}}
{{- $options := slice -}}
{{- $baseURL := strings.TrimSuffix "/" $p.Site.BaseURL -}}
{{- range $p.Site.Params.versions -}}
{{- if ne .name "---" -}}
{{- $versionID := .version | default (.name | urlize) -}}
{{- $rawURL := .url | default "" -}}
{{- $available := ne $rawURL "" -}}
{{- $target := partial "version-target.html" (dict "page" $p "version" .) -}}
{{- $options = $options | append (dict
"id" $versionID
"title" (.name | default .version | plainify)
"url" $target.url
"active" (or (eq .version $p.Site.Params.version) (eq $baseURL (strings.TrimSuffix "/" $rawURL)))
"available" $available
"disabledReason" (cond $available "" (printf "URL %s" (T "ui_field_required")))
"equivalent" $target.equivalent
"fallback" $target.fallback
) -}}
{{- end -}}
{{- end -}}
{{- return $options -}}