version: don't deactivate version switcher if search is disabled #1050
Some checks are pending
docs-build-deployment / Run deploy (push) Waiting to run
docs-build / Run build (push) Waiting to run

This commit is contained in:
Sören Weber 2025-03-18 20:41:27 +01:00
parent 5ba09afb6c
commit 75d9bc2b2e
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 18 additions and 18 deletions

View file

@ -33,7 +33,6 @@
{{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Language.LanguageCode }}
{{- $contentlangs := (union (slice | append (site.Params.additionalContentLanguage | default slice)) (slice $pageBaseLang)) }}
{{- $quotedcontentlangs := slice }}
{{- $versionIndexUrl := "" }}
{{- $searchIndexUrl := "" }}
<link href="{{(printf "css/theme%s.css" $min) | relURL}}{{ $assetBusting }}" rel="stylesheet">
<link href="{{(printf "css/format-%s%s.css" $outputFormat $min) | relURL}}{{ $assetBusting }}" rel="stylesheet" id="R-format-style">
@ -44,22 +43,6 @@
{{- with resources.Get "/js/auto-complete/auto-complete.js" }}
<script src="{{ (. | minify).RelPermalink }}{{ $assetBusting }}" defer></script>
{{- end }}
{{- $versions := partialCached "_relearn/siteVersions.gotmpl" . }}
{{- if $versions }}
{{- $versionIndexUrl = trim (or .Site.Params.versionIndexURL "versionindex.js") "/" }}
{{- $versionIndexUrl = path.Join (path.Dir $versionIndexUrl) (print (path.BaseName $versionIndexUrl) "." site.Language.Lang (path.Ext $versionIndexUrl)) }}
{{- if .IsHome }}
{{- $templateres := resources.Get "/_relearn_versionindex.js" }}
{{- $resultres := $templateres | resources.ExecuteAsTemplate $versionIndexUrl site.Home }}
{{- /* the following code causes Hugo to generate our file in public */}}
{{- $url := $resultres.RelPermalink }}
{{- end }}
{{- with (where $versions "isLatest" true | first 1) }}
{{- range . }}
{{- $versionIndexUrl = path.Join .baseURL $versionIndexUrl }}
{{- end }}
{{- end }}
{{- end }}
{{- if not .Site.Params.disableSearchIndex }}
{{- $searchIndexUrl = trim (or .Site.Params.searchIndexURL "searchindex.js") "/" }}
{{- $searchIndexUrl = path.Join (path.Dir $searchIndexUrl) (print (path.BaseName $searchIndexUrl) "." .Language.Lang (path.Ext $searchIndexUrl)) }}
@ -114,6 +97,23 @@
{{- range $contentlangs }}
{{- $quotedcontentlangs = $quotedcontentlangs | append (printf "'%s'" .) }}
{{- end }}
{{- $versionIndexUrl := "" }}
{{- $versions := partialCached "_relearn/siteVersions.gotmpl" . }}
{{- if $versions }}
{{- $versionIndexUrl = trim (or .Site.Params.versionIndexURL "versionindex.js") "/" }}
{{- $versionIndexUrl = path.Join (path.Dir $versionIndexUrl) (print (path.BaseName $versionIndexUrl) "." site.Language.Lang (path.Ext $versionIndexUrl)) }}
{{- if .IsHome }}
{{- $templateres := resources.Get "/_relearn_versionindex.js" }}
{{- $resultres := $templateres | resources.ExecuteAsTemplate $versionIndexUrl site.Home }}
{{- /* the following code causes Hugo to generate our file in public */}}
{{- $url := $resultres.RelPermalink }}
{{- end }}
{{- with (where $versions "isLatest" true | first 1) }}
{{- range . }}
{{- $versionIndexUrl = path.Join .baseURL $versionIndexUrl }}
{{- end }}
{{- end }}
{{- end }}
<script>
window.relearn = window.relearn || {};
{{ "// configuration" | safeJS }}

View file

@ -1 +1 @@
7.5.0+bc0011fc05abbd9f079145b753dab4fa6b823077
7.5.0+5ba09afb6c62227e5e432359be04159973e3774b