From a31925cea06c06362682ad5e7323b15f229dcfab Mon Sep 17 00:00:00 2001 From: Gabriel Birke Date: Sun, 18 Mar 2018 22:24:43 +0100 Subject: [PATCH] Allow external JS and CSS to be included Allow params.custom_css and params.custom_js to contain HTTP and HTTPS URLs. --- README.md | 6 +++--- layouts/partials/head.html | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a6087ead..f6959c81 100644 --- a/README.md +++ b/README.md @@ -187,18 +187,18 @@ paginate = 10 url = "/about/" ``` -* Override the theme by linking to custom CSS files: +* Override the theme by linking to custom CSS files or URLs: ```toml [params] custom_css = ["css/my.css"] ``` -* Add new behaviours by linking to custom JS files: +* Add new behaviours by linking to custom JS files or URLs: ```toml [params] - custom_js = ["js/my.js"] + custom_js = ["js/my.js", "https://cdnjs.cloudflare.com/ajax/libs/zooming/1.4.2/zooming.min.js"] ``` ## Shortcodes diff --git a/layouts/partials/head.html b/layouts/partials/head.html index f503bfb8..f31a14b9 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -52,10 +52,18 @@ {{ partial "favicon.html" . }} {{ range .Site.Params.custom_css }} - + {{ if findRE "https?://" . }} + + {{ else }} + + {{ end }} {{ end }} {{ range .Site.Params.custom_js }} - + {{ if findRE "https?://" . }} + + {{ else }} + + {{ end }} {{ end }}