diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-07-24 13:05:46 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-07-24 13:05:46 +0200 |
| commit | 6d842eefd0831c89f3be60e85dba91304fd3d00d (patch) | |
| tree | 04a246f5657986e560b2402073a5e8ecf2c82b7e /layouts/partials | |
| parent | 6be75b5d6ac6ea9e26569bb553a67218e75d2ae2 (diff) | |
| download | gohugo-theme-ed-6d842eefd0831c89f3be60e85dba91304fd3d00d.tar.gz | |
Provide 'Back to top' functionality
Diffstat (limited to 'layouts/partials')
| -rw-r--r-- | layouts/partials/head.html | 3 | ||||
| -rw-r--r-- | layouts/partials/scripts.html | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 934ccc9..036b26d 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -35,6 +35,7 @@ {{- template "partials/templates/twitter_cards.html" . }} {{- template "partials/templates/schema_json.html" . }} - {{- /* SEO */}} + {{- /* Scripts */}} + {{- partial "partials/scripts.html" . }} {{- partial "partials/seo/ga.html" . }} </head> diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html new file mode 100644 index 0000000..a42e492 --- /dev/null +++ b/layouts/partials/scripts.html @@ -0,0 +1,14 @@ +{{- $isProduction := (or (eq (getenv "HUGO_ENV") "production") (eq site.Params.env "production")) -}} + +{{- $scripts := slice -}} +{{- $scripts = $scripts | append (resources.Get "js/ed.js") -}} +{{- $scripts = $scripts | resources.Concat "js/common.js" -}} + +{{- $scripts = $scripts | js.Build (dict "format" "iife" "minify" $isProduction) -}} + +{{- if or (site.Params.assets.disable_fingerprinting) (not $isProduction) }} + <script src="{{ $scripts.RelPermalink }}"></script> +{{- else -}} + {{- $scripts = $scripts | fingerprint }} + <script src="{{ $scripts.RelPermalink }}" integrity="{{ $scripts.Data.Integrity }}"></script> +{{- end -}} |
