aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorolOwOlo <26087907+olOwOlo@users.noreply.github.com>2018-07-06 22:24:47 +0800
committerolOwOlo <26087907+olOwOlo@users.noreply.github.com>2018-07-06 22:24:47 +0800
commita3cab1a3542932c3a9ed53d5dbca7158efe3120f (patch)
tree51df94c2f7bfefd6d220567a881bd293341763a3
parentcec9ea91bc4218421d3bf227c301519a839cb4af (diff)
feat(mathjax): configure to let mathjax use local files
Close #63
-rw-r--r--exampleSite/config.toml3
-rw-r--r--layouts/partials/scripts.html6
2 files changed, 8 insertions, 1 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index a41c74f..624cc0b 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -70,9 +70,12 @@ copyright = "" # default: author.name ↓ # 默认为下面配
toc = true # 是否开启目录
autoCollapseToc = false # Auto expand and collapse toc # 目录自动展开/折叠
fancybox = true # see https://github.com/fancyapps/fancybox # 是否启用fancybox(图片可点击)
+
+ # mathjax
mathjax = false # see https://www.mathjax.org/ # 是否使用mathjax(数学公式)
mathjaxEnableSingleDollar = false # 是否使用 $...$ 即可進行inline latex渲染
mathjaxEnableAutoNumber = false # 是否使用公式自动编号
+ mathjaxUseLocalFiles = false # You should install mathjax in `yout-site/static/lib/mathjax`
postMetaInFooter = true # contain author, lastMod, markdown link, license # 包含作者,上次修改时间,markdown链接,许可信息
linkToMarkDown = false # Only effective when hugo will output .md files. # 链接到markdown原始文件(仅当允许hugo生成markdown文件时有效)
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 1a71393..b9c9a55 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -78,7 +78,11 @@
messageStyle: 'none'
};
</script>
- <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script>
+ {{ if .Site.Params.mathjaxUseLocalFiles -}}
+ <script type="text/javascript" async src="{{ "lib/mathjax/MathJax.js?config=TeX-MML-AM_CHTML" | relURL }}"></script>
+ {{- else -}}
+ <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script>
+ {{- end }}
{{- end }}
<!-- Analytics -->