Skip to content

Commit

Permalink
Allow external JS and CSS to be included
Browse files Browse the repository at this point in the history
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 a31925c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions layouts/partials/head.html
Expand Up @@ -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.