diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-07-05 01:39:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-05 01:39:56 +0200 |
| commit | 03a5d662e498ac295e6aab2c0322d624f76ffa2e (patch) | |
| tree | 5f92cccab02c899071424bc02b7dde08f75cf602 /layouts/partials/scripts.html | |
| parent | f1cb48a7e000be9332d22aa5f0f40bb36015839c (diff) | |
| parent | 143f31a09673045925622d062c993315c62cff41 (diff) | |
| download | gohugo-theme-ed-03a5d662e498ac295e6aab2c0322d624f76ffa2e.tar.gz | |
Merge pull request #6 from sergeyklay/feature/search
Implementing search
Diffstat (limited to 'layouts/partials/scripts.html')
| -rw-r--r-- | layouts/partials/scripts.html | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 8d51a70..1574f7e 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -1,11 +1,14 @@ {{- $vendors := slice -}} -{{- $vendorNames := slice "jquery.min" -}} +{{- $vendorNames := slice "jquery.js" "lunr.js" -}} {{- range $vendorNames -}} - {{ $vendors = $vendors | append (resources.Get (printf "js/vendor/%s.js" .) ) }} + {{ $vendors = $vendors | append (resources.Get (printf "js/vendor/%s" .) ) }} {{- end -}} -{{- $vendors := $vendors | resources.Concat "js/vendor-bundle.js" | minify -}} +{{- $vendors = $vendors | resources.Concat "js/vendor-bundle.js" -}} +{{- if or (eq (getenv "HUGO_ENV") "production") (eq site.Params.env "production") }} + {{- $vendors = $vendors | minify -}} +{{- end -}} {{- if not site.Params.assets.disable_fingerprinting -}} {{- $vendors = $vendors | fingerprint -}} @@ -14,6 +17,17 @@ <script src="{{ $vendors.RelPermalink }}"></script> {{- end -}} +{{- $search := resources.Get "js/search.js" -}} +{{- if or (eq (getenv "HUGO_ENV") "production") (eq site.Params.env "production") }} + {{- $search = $search | minify -}} +{{- end -}} +{{- if not site.Params.assets.disable_fingerprinting -}} + {{- $search = $search | fingerprint -}} + <script src="{{ $search.RelPermalink }}" integrity="{{ $search.Data.Integrity }}"></script> +{{- else -}} + <script src="{{ $search.RelPermalink }}"></script> +{{- end -}} + {{- with site.GoogleAnalytics -}} {{- $ga := resources.Get "js/ga.js" | minify -}} {{- if not site.Params.assets.disable_fingerprinting -}} |
