Skip to content

Commit

Permalink
Merge pull request #67 from gbirke/allow-external-resources
Browse files Browse the repository at this point in the history
Allow external JS and CSS to be included
  • Loading branch information
yoshiharuyamashita committed Apr 8, 2018
2 parents f976ec9 + a31925c commit 1bd3b1a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -187,18 +187,18 @@ paginate = 10
url = "/about/" url = "/about/"
``` ```


* Override the theme by linking to custom CSS files: * Override the theme by linking to custom CSS files or URLs:


```toml ```toml
[params] [params]
custom_css = ["css/my.css"] 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 ```toml
[params] [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 ## Shortcodes
Expand Down
12 changes: 10 additions & 2 deletions layouts/partials/head.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,10 +52,18 @@
{{ partial "favicon.html" . }} {{ partial "favicon.html" . }}


{{ range .Site.Params.custom_css }} {{ 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 }} {{ end }}
{{ range .Site.Params.custom_js }} {{ range .Site.Params.custom_js }}
<script src="{{ $.Site.BaseURL }}{{ . }}"></script> {{ if findRE "https?://" . }}
<script src="{{ . }}"></script>
{{ else }}
<script src="{{ $.Site.BaseURL }}{{ . }}"></script>
{{ end }}
{{ end }} {{ end }}


</head> </head>

0 comments on commit 1bd3b1a

Please sign in to comment.