Permalink
Browse files

Allow external JS and CSS to be included

Allow params.custom_css and params.custom_js to contain HTTP and HTTPS
URLs.
  • Loading branch information...
gbirke committed Mar 18, 2018
1 parent f976ec9 commit a31925cea06c06362682ad5e7323b15f229dcfab
Showing with 13 additions and 5 deletions.
  1. +3 −3 README.md
  2. +10 −2 layouts/partials/head.html
@@ -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
@@ -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>

0 comments on commit a31925c

Please sign in to comment.