From 9824fe3e2e0b54c7320df87effcfed1455989119 Mon Sep 17 00:00:00 2001 From: zwbetz-gh Date: Mon, 16 Nov 2020 20:32:11 -0600 Subject: support custom css and js files --- README.md | 10 ++++++---- exampleSite/config.yaml | 14 ++++++-------- exampleSite/static/css/custom_01.css | 3 +++ exampleSite/static/css/custom_02.css | 3 +++ exampleSite/static/js/custom_01.js | 3 +++ exampleSite/static/js/custom_02.js | 3 +++ layouts/partials/head.html | 4 ++-- layouts/partials/script.html | 4 ++++ 8 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 exampleSite/static/css/custom_01.css create mode 100644 exampleSite/static/css/custom_02.css create mode 100644 exampleSite/static/js/custom_01.js create mode 100644 exampleSite/static/js/custom_02.js diff --git a/README.md b/README.md index 3e6a74c..474b365 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ An accessibility-friendly Hugo theme, ported from the [original Cupper](https:// - [Syntax highlighting](#syntax-highlighting) - [Disable toc for a blog post](#disable-toc-for-a-blog-post) - [Localization](#localization) -- [Custom css](#custom-css) +- [Custom CSS and JS](#custom-css-and-js) - [Getting help](#getting-help) - [Credits](#credits) @@ -92,11 +92,13 @@ The strings in the templates of this theme can be localized. Make a copy of ` { + console.log(message); +}; diff --git a/exampleSite/static/js/custom_02.js b/exampleSite/static/js/custom_02.js new file mode 100644 index 0000000..4fb8691 --- /dev/null +++ b/exampleSite/static/js/custom_02.js @@ -0,0 +1,3 @@ +const yourCustomFunction02 = (message) => { + console.log(message); +}; diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 2f20857..490f21d 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -26,9 +26,9 @@ {{ $styles := $templateStyles | resources.ExecuteAsTemplate "css/styles.css" . }} - {{ range .Site.Params.customCss -}} + {{ range .Site.Params.customCss }} - {{- end }} + {{ end }}