Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/vickylaixy/hugo-theme-introduction.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinh T. Tô <31973230+linhtto@users.noreply.github.com>2020-08-08 17:52:35 +0300
committerGitHub <noreply@github.com>2020-08-08 17:52:35 +0300
commitb7ecf0c08c110f11cc215b7154fb1349263ca106 (patch)
tree98be7af4bbdcae98e2b898c1282e714439ed6a70
parentecb89b781b1691172ac13ec142eefa209fbafa00 (diff)
Allow for Custom JavaScript files (#233)
-rw-r--r--README.md6
-rw-r--r--exampleSite/config.toml1
-rw-r--r--layouts/partials/footer/scripts.html6
3 files changed, 12 insertions, 1 deletions
diff --git a/README.md b/README.md
index 27e73b2..ecc7de4 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 13e9bf6..e5e2d74 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -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]
diff --git a/layouts/partials/footer/scripts.html b/layouts/partials/footer/scripts.html
index 6142f3d..7454f32 100644
--- a/layouts/partials/footer/scripts.html
+++ b/layouts/partials/footer/scripts.html
@@ -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 }}