mirror of
https://github.com/theNewDynamic/gohugo-theme-ananke.git
synced 2025-06-08 09:12:47 +00:00
The new front matter variable `page_scripts` allows to specify javascript ressources to be loaded in sync or async mode. This allows javascript code to be loaded, that is only required for a small set of pages (e.g. showing a map or a slider animation).
11 lines
333 B
HTML
11 lines
333 B
HTML
{{ $script := .Site.Data.webpack_assets.app }}
|
|
{{ with $script.js }}
|
|
<script src="{{ relURL (printf "%s%s" "dist/" .) }}"></script>
|
|
{{ end }}
|
|
{{ range .Params.page_scripts.sync }}
|
|
<script src="{{ relURL (.) }}"></script>
|
|
{{ end }}
|
|
{{ range .Params.page_scripts.async }}
|
|
<script async src="{{ relURL (.) }}"></script>
|
|
{{ end }}
|