Lars Kruse 08df330971 Add support for page-specific extra scripts
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).
2020-06-15 04:46:18 +02:00

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 }}