aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exampleSite/config.toml13
-rw-r--r--layouts/partials/head.html10
-rw-r--r--layouts/partials/scripts.html12
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 = "<a rel=\"license\" href=\"https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License\" target=\"_blank\">Creative Commons Attribution-ShareAlike License</a>"
+ contentCopyright = '<a rel="license" href="https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License" target="_blank">Creative Commons Attribution-ShareAlike License</a>'
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 = '<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>'
+ slideout = '<script src="https://cdn.jsdelivr.net/npm/slideout@1.0.1/dist/slideout.min.js" integrity="sha256-t+zJ/g8/KXIJMjSVQdnibt4dlaDxc9zXr/9oNPeWqdg=" crossorigin="anonymous"></script>'
+ fancyboxJs = '<script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.1.20/dist/jquery.fancybox.min.js" integrity="sha256-XVLffZaxoWfGUEbdzuLi7pwaUJv1cecsQJQqGLe7axY=" crossorigin="anonymous"></script>'
+ fancyboxCss = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.1.20/dist/jquery.fancybox.min.css" integrity="sha256-7TyXnr2YU040zfSP+rEcz29ggW4j56/ujTPwjMzyqFY=" crossorigin="anonymous">'
+
[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 @@
<!-- Styles -->
<link href="{{ "dist/even.min.css?v=2.5.0" | relURL }}" rel="stylesheet">
{{ if .Site.Params.bootcdn -}}
- {{ if .Site.Params.fancybox }}<link href="https://cdn.bootcss.com/fancybox/3.1.20/jquery.fancybox.min.css" rel="stylesheet">{{ end }}
-{{ else -}}
+ {{ if .Site.Params.fancybox }}<link href="https://cdn.bootcss.com/fancybox/3.1.20/jquery.fancybox.min.css" rel="stylesheet" crossorigin="anonymous">{{ end }}
+{{- else if .Site.Params.publicCDN.enable -}}
+ {{ if .Site.Params.fancybox }}{{ .Site.Params.publicCDN.fancyboxCss | safeHTML }}{{ end }}
+{{- else -}}
{{ if .Site.Params.fancybox }}<link href="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.css" | relURL }}" rel="stylesheet">{{ end }}
{{- end }}
@@ -66,6 +68,6 @@
<!-- Polyfill for old browsers -->
{{ `<!--[if lt IE 9]>
- <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
- <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
+ <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js" integrity="sha256-9uAoNWHdszsUDhSXf/rVcWOqKPfi5/8V5R4UdbZle2A=" crossorigin="anonymous"></script>
+ <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js" crossorigin="anonymous"></script>
<![endif]-->` | 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 @@
<!-- js -->
<script src="{{ "lib/highlight/highlight.pack.js" | relURL }}"></script>
{{ if .Site.Params.bootcdn -}}
- <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
- <script type="text/javascript" src="https://cdn.bootcss.com/slideout/1.0.1/slideout.min.js"></script>
- {{ if .Site.Params.fancybox }}<script type="text/javascript" src="https://cdn.bootcss.com/fancybox/3.1.20/jquery.fancybox.min.js"></script>{{ end }}
-{{ else -}}
+ <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js" crossorigin="anonymous"></script>
+ <script type="text/javascript" src="https://cdn.bootcss.com/slideout/1.0.1/slideout.min.js" crossorigin="anonymous"></script>
+ {{ if .Site.Params.fancybox }}<script type="text/javascript" src="https://cdn.bootcss.com/fancybox/3.1.20/jquery.fancybox.min.js" crossorigin="anonymous"></script>{{ 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 -}}
<script type="text/javascript" src="{{ "lib/jquery/jquery-3.2.1.min.js" | relURL }}"></script>
<script type="text/javascript" src="{{ "lib/slideout/slideout-1.0.1.min.js" | relURL }}"></script>
{{ if .Site.Params.fancybox }}<script type="text/javascript" src="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.js" | relURL }}"></script>{{ end }}