From 33594c0d1307e1aad56823a7ac5ba6bb18a5d294 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 3 Feb 2018 21:41:44 +0800 Subject: feat: support custom css and js (#29) --- exampleSite/config.toml | 5 +++++ layouts/partials/head.html | 5 +++++ layouts/partials/scripts.html | 7 ++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 8350b64..984abf3 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -81,6 +81,11 @@ copyright = "" # default: author.name ↓ # 默认为下面配 baidu_verification = "" # Baidu Verification google_verification = "" # Google_Verification # 谷歌 + # Link custom CSS and JS assets + # (relative to /static/css and /static/js respectively) + customCSS = [] + customJS = [] + [params.publicCDN] # load these files from public cdn # 启用公共CDN,需自行定义 enable = false jquery = '' diff --git a/layouts/partials/head.html b/layouts/partials/head.html index fb4dad6..fb8c284 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -68,6 +68,11 @@ {{ if .Site.Params.fancybox }}{{ end }} {{- end }} + +{{ range .Site.Params.customCSS }} + +{{ end }} + {{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/spf13/hugo/blob/master/tpl/tplimpl/template_embedded.go#L158 */}} {{- template "_internal/opengraph.html" . -}} {{- template "_internal/google_news.html" . -}} diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index cb26278..89c087a 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -59,4 +59,9 @@ s.parentNode.insertBefore(bp, s); })(); -{{- end }} \ No newline at end of file +{{- end }} + + +{{ range .Site.Params.customJS }} + +{{ end }} -- cgit v1.2.3