From 5fb5a658e8ec8f26c4cb67bc306d1827b781962c Mon Sep 17 00:00:00 2001 From: olOwOlo <26087907+olOwOlo@users.noreply.github.com> Date: Tue, 12 Sep 2017 23:59:08 +0800 Subject: [PATCH] feat: config public cdn deprecated bootcdn param --- exampleSite/config.toml | 13 ++++++++++--- layouts/partials/head.html | 10 ++++++---- layouts/partials/scripts.html | 12 ++++++++---- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 0ca7001..970a32f 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -52,17 +52,17 @@ copyright = "" # default: author.name ↓ # 默认为下面配 archive-paginate = 3 # show word count and read time ? # 是否显示字数统计与阅读时间 - moreMeta = true + moreMeta = false # 一些全局开关,你可以在每一篇内容的 front matter 中单独关闭某些选项 # Some global options, you can close something in front matter. toc = true # 是否开启目录 fancybox = true # see https://github.com/fancyapps/fancybox # 是否启用fancybox(图片可点击) - bootcdn = false # In china. # 是否使用bootcdn(针对大陆推荐使用) + bootcdn = false # In china. @Deprecated: use [params.publicCDN] # 是否使用bootcdn(@Deprecated: 请使用[params.publicCDN]) mathjax = true # see https://www.mathjax.org/ # 是否使用mathjax(数学公式) linkToMarkDown = false # if you config contentCopyright and hugo output .md files. # 是否在链接到markdown原始文件(如果你配置了下面的许可协议并允许hugo生成markdown文件) - contentCopyright = "Creative Commons Attribution-ShareAlike License" + contentCopyright = 'Creative Commons Attribution-ShareAlike License' changyanAppid = "" # Changyan app id # 畅言 changyanAppkey = "" # Changyan app key @@ -71,6 +71,13 @@ copyright = "" # default: author.name ↓ # 默认为下面配 baidu_verification = "" # Baidu Verification google_verification = "" # Google_Verification # 谷歌 + [params.publicCDN] # load these files from public cdn # 启用公共CDN,需自行定义 + enable = false + jquery = '' + slideout = '' + fancyboxJs = '' + fancyboxCss = '' + [params.reward] # 文章打赏 enable = false wechat = "/path/to/your/wechat-qr-code.png" # 微信二维码 diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 66d34eb..5a9ed21 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -53,8 +53,10 @@ {{ if .Site.Params.bootcdn -}} - {{ if .Site.Params.fancybox }}{{ end }} -{{ else -}} + {{ if .Site.Params.fancybox }}{{ end }} +{{- else if .Site.Params.publicCDN.enable -}} + {{ if .Site.Params.fancybox }}{{ .Site.Params.publicCDN.fancyboxCss | safeHTML }}{{ end }} +{{- else -}} {{ if .Site.Params.fancybox }}{{ end }} {{- end }} @@ -66,6 +68,6 @@ {{ `` | safeHTML }} diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 72bc938..5e1c637 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -1,10 +1,14 @@ {{ if .Site.Params.bootcdn -}} - - - {{ if .Site.Params.fancybox }}{{ end }} -{{ else -}} + + + {{ if .Site.Params.fancybox }}{{ end }} +{{- else if .Site.Params.publicCDN.enable -}} + {{ .Site.Params.publicCDN.jquery | safeHTML }} + {{ .Site.Params.publicCDN.slideout | safeHTML }} + {{ if .Site.Params.fancybox }}{{ .Site.Params.publicCDN.fancyboxJs | safeHTML }}{{ end }} +{{- else -}} {{ if .Site.Params.fancybox }}{{ end }}