summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md25
-rw-r--r--README_CN.md25
-rw-r--r--layouts/_default/single.html2
-rw-r--r--layouts/partials/sidebar.html8
4 files changed, 36 insertions, 24 deletions
diff --git a/README.md b/README.md
index a7e8a05..e943603 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ Now supported i18n langs: en, zh-hans, zh-hant, ja, nl. Check the i18n folder to
- [🆕 Update the theme](#-update-the-theme)
- [⚙️ Configuration](#%EF%B8%8F-configuration)
- [🎨 Favicon](#-favicon)
- - [❌ In-post license, comments und toc](#-in-post-license-comments-und-toc)
+ - [❌ License, toc und comments](#-license-toc-und-comments)
- [🎵 APlayer](#-aplayer)
- [📷 Image zoom and lazyload settings](#-image-zoom-and-lazyload-settings)
- [⚓ Markdown render hook](#-markdown-render-hook)
@@ -30,7 +30,7 @@ Now supported i18n langs: en, zh-hans, zh-hant, ja, nl. Check the i18n folder to
## 💻 Live demos
-[**Live Demo by Vercel (en)**](https://hugo-theme-fuji-demo.now.sh/) | [My Blog by Coding (zh-Hans)](https://blog.amzrk2.cc/)
+[**Live Demo (en)**](https://hugo-theme-fuji-demo.now.sh/) | [My Blog (zh-Hans)](https://blog.amzrk2.cc/)
![Screenshot of Fuji](https://raw.githubusercontent.com/amzrk2/hugo-theme-fuji/master/images/screenshot.png)
@@ -76,21 +76,26 @@ Create `[SITEROOT]/layouts/partials/favicon.html` to cover theme's favicon.
You can generate your favicons in [realfavicongenerator.net](https://realfavicongenerator.net/).
-### ❌ In-post license, comments und toc
+### ❌ License, toc und comments
-You can set variables below in post's front matter to disable them:
+Globally in `config.toml`:
```toml
-noLicense = true # Do not show license in this post
-noComments = true # Do not show comments in this post
-noToc = true # Do not show toc in this post
+showLicense = true # Enable or disable license for all post
+showToc = true # Enable or disable ToC for all post
+```
+
+Or in posts' front matter:
+
+```toml
+showLicense = true # Enable or disable license for this specific post
+showToc = true # Enable or disable ToC for this specific post
```
-Or you can disable these globally, set these below to false or comment it in your `config.toml`:
+To disable comment area for specific post, add this in front matter:
```toml
-showLicense = false
-showToc = false
+noComments = true # Do not show comments in this post
```
### 🎵 APlayer
diff --git a/README_CN.md b/README_CN.md
index 17fe0c0..75d1c86 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -18,7 +18,7 @@
- [🆕 更新主题](#-更新主题)
- [⚙️ 自定义设置](#%EF%B8%8F-自定义设置)
- [🎨 站点图标](#-站点图标)
- - [❌ 关闭 License、评论区和目录](#-关闭-license评论区和目录)
+ - [❌ License、目录和评论区](#-license目录和评论区)
- [🎵 文章音乐](#-文章音乐)
- [📷 图片放大的设置和 lazyload](#-图片放大的设置和-lazyload)
- [⚓ Markdown 钩子](#-markdown-钩子)
@@ -30,7 +30,7 @@
## 💻 在线 Demo
-[**在线 Demo - Vercel (英文)**](https://hugo-theme-fuji-demo.now.sh/) | [我的博客 - Coding (中文)](https://blog.amzrk2.cc/)
+[**在线 Demo (英文)**](https://hugo-theme-fuji-demo.now.sh/) | [我的博客 (中文)](https://blog.amzrk2.cc/)
![Fuji 截图](https://raw.githubusercontent.com/amzrk2/hugo-theme-fuji/master/images/screenshot.png)
@@ -66,21 +66,26 @@ $ git submodule update --remote --merge
可以在 [realfavicongenerator.net](https://realfavicongenerator.net/) 快速创建自己的图标。
-### ❌ 关闭 License、评论区和目录
+### ❌ License、目录和评论区
-在 front matter 里加上这些:
+在全局的 `config.toml` 里设置:
```toml
-noLicense = true # 憋显示 License
-noComments = true # 憋显示评论区
-noToc = true # 憋显示目录
+showLicense = true # 对所有文章开关 License 显示
+showToc = true # 对所有文章开关目录显示
```
-你也可以全局关闭这些内容的显示,在 `config.toml` 把下面这些设置为 false 或注释掉:
+在特定文章的 front matter 里设置:
```toml
-showLicense = false
-showToc = false
+showLicense = true # 对这篇文章开关 License 显示
+showToc = true # 对这篇文章开关目录显示
+```
+
+除此之外你也可以关闭特定文章的评论:
+
+```toml
+noComments = true # 对这篇文章关闭评论
```
### 🎵 文章音乐
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 413cacc..26a8213 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -16,7 +16,7 @@
</div>
</article>
<!-- post license -->
-{{ if and (.Site.Params.showLicense) (ne .Params.noLicense true) }}
+{{ if and (or .Site.Params.showLicense .Params.showLicense) (ne .Params.showLicense false) }}
<div class="license markdown-body">
<blockquote>
<p>{{ i18n "postCopyrightFront" }}<a rel="license" href="{{ .Site.Params.licenseLink }}"
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index a730c0b..af737ce 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -1,11 +1,13 @@
<aside class="col-12 col-md-3 float-left sidebar">
<!-- in-post toc -->
- {{ if and (in .Site.Params.mainSections .Type) (and (.Site.Params.showToc) (ne .Params.noToc true)) }}
+ {{ if in .Site.Params.mainSections .Type }}
+ {{ if and (or .Site.Params.showToc .Params.showToc) (ne .Params.showToc false) }}
<div class="sidebar-item sidebar-toc">
<h3>{{ i18n "sidebarToc" }}</h3>
{{ .TableOfContents }}
</div>
{{ end }}
+ {{ end }}
<!-- pages -->
<div class="sidebar-item sidebar-pages">
<h3>{{ i18n "sidebarPages" }}</h3>
@@ -43,8 +45,8 @@
<!-- bgm.tv image chart -->
<div class="sidebar-item sidebar-bgm">
<h3>{{ i18n "sidebarBangumiChart" }}</h3>
- <img class="lazyload" src="{{ $.Site.Params.lazyPlaceholder | relURL }}" data-src="https://bgm.tv/chart/img/{{ . }}"
- alt="Bangumi 图像榜单" />
+ <img class="lazyload" src="{{ $.Site.Params.lazyPlaceholder | relURL }}"
+ data-src="https://bgm.tv/chart/img/{{ . }}" alt="Bangumi 图像榜单" />
</div>
{{ end }}
</aside> \ No newline at end of file