diff options
author | Alex Shpak <alex-shpak@users.noreply.github.com> | 2021-05-19 20:26:21 +0200 |
---|---|---|
committer | Alex Shpak <alex-shpak@users.noreply.github.com> | 2021-05-19 20:26:21 +0200 |
commit | d7c644f0e7062bd847911bcfd9d9eaf401f3c36d (patch) | |
tree | 7b9d3c6d1587df722aebf271737ab9c5b1d82b7c /layouts/partials | |
parent | 843144dd85e374ade722e2f2b0b3511a0e34d8f6 (diff) |
Refactor search, prepare for pre-built indexing
Diffstat (limited to 'layouts/partials')
-rw-r--r-- | layouts/partials/docs/html-head.html | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/layouts/partials/docs/html-head.html b/layouts/partials/docs/html-head.html index 905904f..647511b 100644 --- a/layouts/partials/docs/html-head.html +++ b/layouts/partials/docs/html-head.html @@ -12,22 +12,23 @@ <link rel="icon" href="{{ "favicon.png" | relURL }}" type="image/x-icon"> {{- range .Translations }} -<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}"> -{{ end -}} + <link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}"> +{{- end -}} <!-- Theme stylesheet, you can customize scss by creating `assets/custom.scss` in your website --> {{- $styles := resources.Get "book.scss" | resources.ExecuteAsTemplate "book.scss" . | resources.ToCSS | resources.Minify | resources.Fingerprint }} <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}"> -{{- if default true .Site.Params.BookSearch }} -{{- $searchJSFile := printf "%s.search.js" .Language.Lang }} -{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }} -<script defer src="{{ $searchJS.RelPermalink }}" integrity="{{ $searchJS.Data.Integrity }}"></script> +{{- if default true .Site.Params.BookSearch -}} + {{- $searchJSFile := printf "%s.search.js" .Language.Lang }} + {{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }} + <script defer src="{{ "flexsearch.min.js" | relURL }}"></script> + <script defer src="{{ $searchJS.RelPermalink }}" integrity="{{ $searchJS.Data.Integrity }}"></script> {{ end -}} -{{- if .Site.Params.BookServiceWorker }} -{{- $swJS := resources.Get "sw-register.js" | resources.ExecuteAsTemplate "sw.js" . | resources.Minify | resources.Fingerprint }} -<script defer src="{{ $swJS.RelPermalink }}" integrity="{{ $swJS.Data.Integrity }}"></script> +{{- if .Site.Params.BookServiceWorker -}} + {{- $swJS := resources.Get "sw-register.js" | resources.ExecuteAsTemplate "sw.js" . | resources.Minify | resources.Fingerprint }} + <script defer src="{{ $swJS.RelPermalink }}" integrity="{{ $swJS.Data.Integrity }}"></script> {{ end -}} {{- template "_internal/google_analytics_async.html" . -}} |