search: index file rename #888

This commit is contained in:
Sören Weber 2024-08-27 00:35:12 +02:00
parent f8e36bb08c
commit 24726ef4b0
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
5 changed files with 8 additions and 8 deletions

View file

@ -16,4 +16,4 @@
) }}
{{- end }}
{{- end -}}
var relearn_search_index = {{ $pages | jsonify (dict "indent" " ") }}
var relearn_searchindex = {{ $pages | jsonify (dict "indent" " ") }}

View file

@ -157,10 +157,10 @@ disableSearch = false
disableSearchIndex = false
# URL of the search index file relative to the language home.
# Default: "search_index.js"
# Default: "searchindex.js"
# You have to set this option if your page already has a content file named
# `search_index.js` in the language home.
searchIndexURL = "search_index.js"
# `searchindex.js` in the language home.
searchIndexURL = "searchindex.js"
# Disable the dedicated search page.
# Default: false

View file

@ -73,7 +73,7 @@ By default all three levels are enabled. You can disable each level by the follo
By default the following files will be created for each level, relative to each languages home page but can be overwritten:
- search popup: `search_index.js`, configured by `searchIndexURL`
- search popup: `searchindex.js`, configured by `searchIndexURL`
- dedicated search page: either `/search.html` or `search/index.html` depending on your settings for `uglyURLs`, configured by `searchPageURL`
{{% notice note %}}

View file

@ -8,8 +8,8 @@
{{- warnf "UNSUPPORTED usage of 'searchpage' output format found, remove it from your config; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#700" }}
{{- end }}
{{- if not .Site.Params.disableSearchIndex }}
{{- $url := path.Join .Site.LanguagePrefix (trim (or .Site.Params.searchIndexURL "search_index.js") "/") }}
{{- $templateres := resources.Get "_relearn_search_index.js" }}
{{- $url := path.Join .Site.LanguagePrefix (trim (or .Site.Params.searchIndexURL "searchindex.js") "/") }}
{{- $templateres := resources.Get "_relearn_searchindex.js" }}
{{- $resultres := $templateres | resources.ExecuteAsTemplate $url .Site.Home }}
{{- /* the following code causes Hugo to generate our file - although it is in comments */}}<!-- {{ $resultres.RelPermalink }} -->
<script>

View file

@ -116,7 +116,7 @@ function initLunrJs() {
js.src = index_js_url;
js.setAttribute("async", "");
js.onload = function(){
initLunrIndex(relearn_search_index);
initLunrIndex(relearn_searchindex);
};
js.onerror = function(e){
console.error('Error getting Hugo index file');