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

github.com/dataCobra/hugo-vitae.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordataCobra <datacobra@thinkbot.de>2021-07-11 19:45:34 +0300
committerdataCobra <datacobra@thinkbot.de>2021-07-11 19:45:34 +0300
commit79c300822b3b42e001c25e533293c964e78cec9f (patch)
tree95abe0e22285247e4354482dd0aeeaaf509301c4
parent04b0597efa5d7274b560cdb7dd1121519b1ff17c (diff)
Add possibility to use custom javascript files #59
This commit ports the pull request #59 to add your own custom javascript files to Vitae version 3.
-rw-r--r--CONTRIBUTORS.md1
-rw-r--r--features.md8
-rw-r--r--layouts/partials/head.html11
3 files changed, 20 insertions, 0 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 588c1dc..de6b885 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -14,3 +14,4 @@ collaboration of others.
* [Bernardo Ayala](https://github.com/nardoyala)
* [Mattia Panzeri](https://github.com/panz3r)
* [Jörg Thalheim](https://github.com/Mic92)
+* [David Kaufmann](https://github.com/davidkaufmann)
diff --git a/features.md b/features.md
index b68e808..373633b 100644
--- a/features.md
+++ b/features.md
@@ -5,6 +5,14 @@
- .Site.Params.description # Add meta description in head part (Site Description or Description of Page)
- .Site.Params.math # Add math typesetting with KaTeX (Global with this param)
- .Site.Params.customcss # Add path to customcss you want to add to the theme
+ - .Site.Params.customjs.enabled # Enable/Disable customjs
+ - .Site.Params.customjs.src # add the source path
+ - .Site.Params.customjs.referrerpolicy # specifies which referrer information to send when fetching the script
+ - .Site.Params.customjs.nomodule # specifies that the script should not be executed in browsers supporting ES2015 modules
+ - .Site.Params.customjs.integrity # allows a browser to check for integrity to ensure the code hasn't been manipulated
+ - .Site.Params.customjs.defer # execute the script when page has finished parsing (external only)
+ - .Site.Params.customjs.crossorigin # sets the mode of the request to an http cors request
+ - .Site.Params.customjs.async # executes the script asynchronously (external only)
- .Site.Params.pagetitle # Add pagetitle to homepage <title> tag
- .Site.Params.avatar # Add a avatar to your website
- .Site.Params.subtitle # Add a subtitle to your website
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 89c5a65..dd8539a 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -32,6 +32,17 @@
document.addEventListener("DOMContentLoaded", function() { renderMathInElement(document.body, { delimiters: [ {left: "$$", right: "$$", display: true}, {left: "$", right: "$", display: false} ] }); });
</script>
{{- end -}}
+{{- if .Site.Params.customjs.enabled }}
+<script
+{{ if eq .Site.Params.customjs.async true }} {{ "async" | safeHTMLAttr}}{{ end }}
+{{ if eq .Site.Params.customjs.defer true }} {{ "defer" | safeHTMLAttr}}{{ end }}
+{{ if eq .Site.Params.customjs.nomodule true }} {{ "nomodule" | safeHTMLAttr}}{{ end }}
+{{ if isset .Site.Params.customjs "crossorigin" }} {{ printf "crossorigin=%q" .Site.Params.customjs.crossorigin | safeHTMLAttr }}{{ end }}
+{{ if isset .Site.Params.customjs "integrity" }} {{ printf "integrity=%q" .Site.Params.customjs.integrity | safeHTMLAttr }}{{ end }}
+{{ if isset .Site.Params.customjs "referrerpolicy" }} {{ printf "referrerpolicy=%q" .Site.Params.customjs.referrerpolicy | safeHTMLAttr }}{{ end }}
+{{ printf "src=%q" (.Site.Params.customjs.src | relURL) | safeHTMLAttr }}>
+</script>
+{{- end }}
{{- if isset .Site.Params "customcss" }}
<link rel="stylesheet" type="text/css" media="screen" href="{{ relURL .Site.Params.customCSS }}" />
{{- end }}