Remove use of Scratch in search configuration

This commit is contained in:
Alex Shpak 2020-01-13 19:42:16 +01:00
parent 134b7456b8
commit 68f096fa4c
2 changed files with 1 additions and 2 deletions

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
(function() { (function() {
const indexCfg = {{ with .Scratch.Get "bookSearchConfig" }} const indexCfg = {{ with i18n "bookSearchConfig" }}
{{ . }}; {{ . }};
{{ else }} {{ else }}
{}; {};

View file

@ -11,7 +11,6 @@
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}"> <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}">
{{ if default true .Site.Params.BookSearch }} {{ if default true .Site.Params.BookSearch }}
{{- .Scratch.Set "bookSearchConfig" (i18n "bookSearchConfig") -}} <!-- Remove after https://github.com/gohugoio/hugo/issues/6331 -->
{{- $searchJSFile := printf "%s.search.js" .Language.Lang -}} {{- $searchJSFile := printf "%s.search.js" .Language.Lang -}}
{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }} {{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }}
<script defer src="{{ $searchJS.RelPermalink }}" integrity="{{ $searchJS.Data.Integrity }}"></script> <script defer src="{{ $searchJS.RelPermalink }}" integrity="{{ $searchJS.Data.Integrity }}"></script>