feat: allow set something for a single content

* Now, you can open or close toc, copyright, reward and mathjax for a single content.
* Also change the default global settings: autoCollapseToc = true -> false; mathjax = true -> false
This commit is contained in:
olOwOlo 2017-12-06 20:34:22 +08:00
parent 8c07810484
commit 1bb6eea8a8
No known key found for this signature in database
GPG key ID: 456394B6E7A15EA6
13 changed files with 50 additions and 47 deletions

View file

@ -9,11 +9,12 @@ tags: []
categories: [] categories: []
author: "" author: ""
# you can close something for this content if you open it in config.toml. # You can also close(false) or open(true) something for this content.
# P.S. comment can only be closed
comment: false comment: false
toc: false toc: false
autoCollapseToc: false autoCollapseToc: false
# you can define another contentCopyright. e.g. contentCopyright: "This is an another copyright." # You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright."
contentCopyright: false contentCopyright: false
reward: false reward: false
mathjax: false mathjax: false

View file

@ -60,13 +60,13 @@ copyright = "" # default: author.name ↓ # 默认为下面配
# show word count and read time ? # 是否显示字数统计与阅读时间 # show word count and read time ? # 是否显示字数统计与阅读时间
moreMeta = false moreMeta = false
# 一些全局开关,你可以在每一篇内容的 front matter 中单独关闭某些选项 # 一些全局开关,你也可以在每一篇内容的 front matter 中针对单篇内容关闭或开启某些功能,在 archetypes/default.md 查看更多信息。
# Some global options, you can close something in front matter. # Some global options, you can also close or open something in front matter for a single post, see more information from `archetypes/default.md`.
toc = true # 是否开启目录 toc = true # 是否开启目录
autoCollapseToc = true # Auto expand and collapse toc # 目录自动展开/折叠 autoCollapseToc = false # Auto expand and collapse toc # 目录自动展开/折叠
fancybox = true # see https://github.com/fancyapps/fancybox # 是否启用fancybox图片可点击 fancybox = true # see https://github.com/fancyapps/fancybox # 是否启用fancybox图片可点击
bootcdn = false # In china. @Deprecated: use [params.publicCDN] # 是否使用bootcdn(@Deprecated: 请使用[params.publicCDN]) bootcdn = false # In china. @Deprecated: use [params.publicCDN] # 是否使用bootcdn(@Deprecated: 请使用[params.publicCDN])
mathjax = true # see https://www.mathjax.org/ # 是否使用mathjax数学公式 mathjax = false # see https://www.mathjax.org/ # 是否使用mathjax数学公式
linkToMarkDown = false # if you config contentCopyright and hugo output .md files. # 是否在链接到markdown原始文件如果你配置了下面的许可协议并允许hugo生成markdown文件 linkToMarkDown = false # if you config contentCopyright and hugo output .md files. # 是否在链接到markdown原始文件如果你配置了下面的许可协议并允许hugo生成markdown文件
contentCopyright = '<a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">CC BY-NC-ND 4.0</a>' contentCopyright = '<a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">CC BY-NC-ND 4.0</a>'

View file

@ -1,3 +0,0 @@
---
mathjax: false
---

View file

@ -6,14 +6,16 @@ draft: false
tags: ["preview", "中文", "tag-1"] tags: ["preview", "中文", "tag-1"]
categories: ["中文"] categories: ["中文"]
author: "Wikipedia" author: "Wikipedia"
# you can close something for this content if you open it in config.toml.
comment: false
# toc: false
# reward: false
mathjax: false
# you can define another contentCopyright. e.g. contentCopyright: "This is an another copyright." # You can also close(false) or open(true) something for this content.
# P.S. comment can only be closed
# comment: false
# toc: false
# autoCollapseToc: false
# You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright."
contentCopyright: '<a rel="license noopener" 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 noopener" 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>'
# reward: false
# mathjax: false
--- ---
>《长恨歌》是中国唐朝诗人白居易的一首长篇叙事诗。 >《长恨歌》是中国唐朝诗人白居易的一首长篇叙事诗。

View file

@ -7,14 +7,15 @@ tags: ["preview", "English", "tag-2"]
categories: ["English"] categories: ["English"]
author: "Michael Henderson" author: "Michael Henderson"
# you can close something for this content if you open it in config.toml. # You can also close(false) or open(true) something for this content.
comment: false # P.S. comment can only be closed
# comment: false
# toc: false # toc: false
# reward: false autoCollapseToc: true
mathjax: false # You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright."
# you can define another contentCopyright. e.g. contentCopyright: "This is an another copyright."
contentCopyright: '<a href="https://github.com/gohugoio/hugoBasicExample" rel="noopener" target="_blank">See origin</a>' contentCopyright: '<a href="https://github.com/gohugoio/hugoBasicExample" rel="noopener" target="_blank">See origin</a>'
# reward: false
# mathjax: false
--- ---
## Introduction ## Introduction

View file

@ -5,19 +5,19 @@ lastmod: 2017-08-23T18:03:09+08:00
draft: false draft: false
tags: ["preview", "Theme preview", "tag-3"] tags: ["preview", "Theme preview", "tag-3"]
categories: ["Theme preview", "category-2", "category-3"] categories: ["Theme preview", "category-2", "category-3"]
author: '<a href="https://laozhu.me" rel="noopener" target="_blank">米老朱</a>'
weight: 10 weight: 10
# you can close something for this content if you open it in config.toml. # You can also close(false) or open(true) something for this content.
comment: false # P.S. comment can only be closed
# comment: false
# toc: false # toc: false
autoCollapseToc: false # autoCollapseToc: false
# reward: false # You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright."
# mathjax: false
# you can define another contentCopyright. e.g. contentCopyright: "This is an another copyright."
author: '<a href="https://laozhu.me" rel="noopener" target="_blank">米老朱</a>'
contentCopyright: '<a href="https://laozhu.me/post/hugo-nuo-post-preview/" rel="noopener" target="_blank">See origin</a>' contentCopyright: '<a href="https://laozhu.me/post/hugo-nuo-post-preview/" rel="noopener" target="_blank">See origin</a>'
# reward: false
mathjax: true
--- ---
> Copy from [《Hugo 主题 Nuo 文章样式预览》](https://laozhu.me/post/hugo-nuo-post-preview/) > Copy from [《Hugo 主题 Nuo 文章样式预览》](https://laozhu.me/post/hugo-nuo-post-preview/)

View file

@ -9,14 +9,15 @@ tags: ["preview", "日本語", "tag-4"]
categories: ["日本語"] categories: ["日本語"]
author: "Wikipedia" author: "Wikipedia"
# you can close something for this content if you open it in config.toml. # You can also close(false) or open(true) something for this content.
comment: false # P.S. comment can only be closed
# comment: false
# toc: false # toc: false
# reward: false # autoCollapseToc: false
mathjax: false # You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright."
# you can define another contentCopyright. e.g. contentCopyright: "This is an another copyright."
contentCopyright: '<a rel="license noopener" 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 noopener" 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>'
# reward: false
# mathjax: false
--- ---
> 日本語の敬語体系は、一般に、大きく尊敬語・謙譲語・丁寧語に分類される。文化審議会国語分科会は、2007年2月に「敬語の指針」を答申し、これに丁重語および美化語を含めた5分類を示している。 > 日本語の敬語体系は、一般に、大きく尊敬語・謙譲語・丁寧語に分類される。文化審議会国語分科会は、2007年2月に「敬語の指針」を答申し、これに丁重語および美化語を含めた5分類を示している。

View file

@ -6,14 +6,15 @@ draft: false
tags: ["preview", "Syntax Highlighting", "tag-5"] tags: ["preview", "Syntax Highlighting", "tag-5"]
categories: ["Syntax Highlighting"] categories: ["Syntax Highlighting"]
# you can close something for this content if you open it in config.toml. # You can also close(false) or open(true) something for this content.
comment: false # P.S. comment can only be closed
# comment: false
toc: false toc: false
# reward: false # autoCollapseToc: false
mathjax: false # You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright."
# you can define another contentCopyright. e.g. contentCopyright: "This is an another copyright."
# contentCopyright: false # contentCopyright: false
# reward: false
# mathjax: false
--- ---

View file

@ -1,4 +1,4 @@
{{ if and .Site.Params.contentCopyright (ne .Params.contentCopyright false) }} {{ if or .Params.contentCopyright (and .Site.Params.contentCopyright (ne .Params.contentCopyright false)) }}
{{ $lang := .Site.Data.even.default -}} {{ $lang := .Site.Data.even.default -}}
<div class="post-copyright"> <div class="post-copyright">
<p class="copyright-item"> <p class="copyright-item">

View file

@ -1,4 +1,4 @@
{{ if and .Site.Params.reward.enable (ne .Params.reward false) }} {{ if or .Params.reward (and .Site.Params.reward.enable (ne .Params.reward false)) }}
<div class="post-reward"> <div class="post-reward">
{{- $lang := .Site.Data.even.default }} {{- $lang := .Site.Data.even.default }}
<input type="checkbox" name="reward" id="reward" hidden /> <input type="checkbox" name="reward" id="reward" hidden />

View file

@ -1,7 +1,7 @@
{{ if and .Site.Params.toc (ne .Params.toc false) }} {{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }}
<div class="post-toc" id="post-toc"> <div class="post-toc" id="post-toc">
<h2 class="post-toc-title">{{ .Site.Data.even.default.posts.toc }}</h2> <h2 class="post-toc-title">{{ .Site.Data.even.default.posts.toc }}</h2>
{{ $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }} {{ $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default false }}
<div class="post-toc-content{{ if not (or .Params.autoCollapseToc (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false))) }} always-active{{ end }}"> <div class="post-toc-content{{ if not (or .Params.autoCollapseToc (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false))) }} always-active{{ end }}">
{{.TableOfContents}} {{.TableOfContents}}
</div> </div>

View file

@ -15,7 +15,7 @@
{{- end }} {{- end }}
<script type="text/javascript" src="{{ "dist/even.min.js?v=2.7.0" | relURL }}"></script> <script type="text/javascript" src="{{ "dist/even.min.js?v=2.7.0" | relURL }}"></script>
{{- if and (and .Site.Params.mathjax (ne .Params.mathjax false)) (or .IsPage .IsHome) }} {{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
<script type="text/javascript"> <script type="text/javascript">
window.MathJax = { window.MathJax = {
showProcessingMessages: false, showProcessingMessages: false,