Allow for Custom JavaScript files (#233)

This commit is contained in:
Linh T. Tô 2020-08-08 10:52:35 -04:00 committed by GitHub
parent ecb89b781b
commit b7ecf0c08c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View file

@ -184,7 +184,11 @@ Set `disqusshortname` in `config.toml` to activate Hugo's [internal Disqus templ
## Custom CSS
You can add custom CSS files by placing them under `assets/` and adding the path to the file to `customCSS` in `config.toml`.
You can add custom CSS files by placing them under `assets/` and adding the paths to the files to the `customCSS` list in `config.toml`.
## Custom JavaScript
You can add custom JavaScript files by placing them under `assets/` and adding the paths to the files to the `customJS` list in `config.toml`.
## Issues

View file

@ -13,6 +13,7 @@ DefaultContentLanguage = "en" # Default language fo
dateFormat = "Jan 2, 2006"
email = "youremail@email.com" # E-mail address for contact section
# customCSS = ["foo.css"] # Include custom css files placed under assets/
# customJS = ["foo.js"] # Include custom JavaScript files placed under assets/
# Configure the home page
[params.home]

View file

@ -4,3 +4,9 @@
<script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script>
{{ template "_internal/google_analytics_async.html" . }}
<!-- Custom JavaScript -->
{{ range .Site.Params.customJS -}}
{{ $script := resources.Get . | minify }}
<script src="{{ $script.Permalink }}" integrity="{{ $script.Data.Integrity }}"></script>
{{- end }}