diff options
author | Yoshiharu Yamashita <yoshiharuyamashita@users.noreply.github.com> | 2018-04-08 11:54:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-08 11:54:53 +0300 |
commit | 1bd3b1a49e8bc7f1236377fb8d65d947fc6f8af7 (patch) | |
tree | a0338d8956ad863fa47d1ddaff2a3164ccc20d01 | |
parent | f976ec9e543870fcf808491891f54ed40a91b36e (diff) | |
parent | a31925cea06c06362682ad5e7323b15f229dcfab (diff) |
Merge pull request #67 from gbirke/allow-external-resources
Allow external JS and CSS to be included
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | layouts/partials/head.html | 12 |
2 files changed, 13 insertions, 5 deletions
@@ -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 f503bfb..f31a14b 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -52,10 +52,18 @@ {{ partial "favicon.html" . }} {{ range .Site.Params.custom_css }} - <link rel="stylesheet" href="{{ $.Site.BaseURL }}{{ . }}"> + {{ if findRE "https?://" . }} + <link rel="stylesheet" href="{{ . }}"> + {{ else }} + <link rel="stylesheet" href="{{ $.Site.BaseURL }}{{ . }}"> + {{ end }} {{ end }} {{ range .Site.Params.custom_js }} - <script src="{{ $.Site.BaseURL }}{{ . }}"></script> + {{ if findRE "https?://" . }} + <script src="{{ . }}"></script> + {{ else }} + <script src="{{ $.Site.BaseURL }}{{ . }}"></script> + {{ end }} {{ end }} </head> |