summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramzrk22020-06-04 15:56:03 +0800
committeramzrk22020-06-04 15:56:03 +0800
commitd185ecccaabcaf4a9cced394d5b72f246bc2e5e7 (patch)
tree559490939ee0de0d63bb8aa9f5aee4745cf9989d
parent2cbde93423c7792929809e95a908913060d786cf (diff)
downloadhugo-theme-fuji-d185ecccaabcaf4a9cced394d5b72f246bc2e5e7.tar.gz
hugo-theme-fuji-d185ecccaabcaf4a9cced394d5b72f246bc2e5e7.tar.bz2
hugo-theme-fuji-d185ecccaabcaf4a9cced394d5b72f246bc2e5e7.zip
Allow disable license globally
-rw-r--r--README.md78
-rw-r--r--README_CN.md73
-rw-r--r--layouts/_default/single.html2
3 files changed, 82 insertions, 71 deletions
diff --git a/README.md b/README.md
index a8e5b0f..8d0283c 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Fuji
+# 🍥 Fuji 🍥
Fuji is a minimal Hugo theme with full dark mode support and GitHub Primer markdown style.
@@ -6,36 +6,36 @@ Fuji is a minimal Hugo theme with full dark mode support and GitHub Primer markd
[English](https://github.com/amzrk2/hugo-theme-fuji#readme) | [简体中文](https://github.com/amzrk2/hugo-theme-fuji/blob/master/README_CN.md)
-## Table of contents
-
-- [Live demos](#live-demos)
-- [Notice](#notice)
-- [Getting started](#getting-started)
-- [Update the theme](#update-the-theme)
-- [Configration](#configration)
- - [Favicon](#favicon)
- - [In-post license & comments](#in-post-license--comments)
- - [APlayer](#aplayer)
- - [Image zoom and lazyload settings](#image-zoom-and-lazyload-settings)
- - [Markdown render hook](#markdown-render-hook)
- - [Comments area](#comments-area)
- - [Load main CSS und JS from CDN](#load-main-css-und-js-from-cdn)
- - [Advanced configuration](#advanced-configuration)
-- [Report und contributing](#report-und-contributing)
-- [License](#license)
-- [Annotations](#annotations)
-
-## Live demos
+## 📑 Table of contents
+
+- [💻 Live demos](#live-demos)
+- [❗ Notice](#notice)
+- [🐣 Getting started](#getting-started)
+- [🆕 Update the theme](#update-the-theme)
+- [⚙️ Configration](#configration)
+ - [🎨 Favicon](#favicon)
+ - [❌ In-post license & comments](#in-post-license--comments)
+ - [🎵 APlayer](#aplayer)
+ - [📷 Image zoom and lazyload settings](#image-zoom-and-lazyload-settings)
+ - [⚓ Markdown render hook](#markdown-render-hook)
+ - [📨 Comments area](#comments-area)
+ - [⏱️ Load main CSS und JS from CDN](#load-main-css-und-js-from-cdn)
+ - [🔧 Advanced configuration](#advanced-configuration)
+- [✏️ Report und contributing](#report-und-contributing)
+- [📝 License](#license)
+- [🤝 Annotations](#annotations)
+
+## 💻 Live demos
[**Live Demo (en)**](https://themes.gohugo.io/theme/hugo-theme-fuji/) | [My Blog (zh-Hans)](https://blog.amzrk2.cc/)
![Screenshot of Fuji](https://raw.githubusercontent.com/amzrk2/hugo-theme-fuji/master/images/screenshot.png)
-## Notice
+## ❗ Notice
Remember to add [summary divider](https://gohugo.io/content-management/summaries/#manual-summary-splitting) `<!--more-->` to your post `.md` files to show blockquotes, links and codes with proper style in list pages' summary part.
-## Getting started
+## 🐣 Getting started
Inside the folder of your Hugo site run:
@@ -55,7 +55,7 @@ $ hugo server
If you want to generate your site, just run `hugo` or `hugo --minify`.
-## Update the theme
+## 🆕 Update the theme
Inside the folder of your Hugo site run:
@@ -63,15 +63,15 @@ Inside the folder of your Hugo site run:
$ git submodule update --remote --merge
```
-## Configration
+## ⚙️ Configration
-### Favicon
+### 🎨 Favicon
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
+### ❌ In-post license & comments
You can set variables below in post's front matter to disable them:
@@ -80,7 +80,13 @@ noLicense = true # Do not show license in this post
noComments = true # Do not show comments in this post
```
-### APlayer
+Or you can disable the license globally, set this below to false or comment it in your `config.toml`:
+
+```toml
+showLicense = false
+```
+
+### 🎵 APlayer
In-post APlayer supported, you can set these variables in post's front matter:
@@ -91,7 +97,7 @@ playerURL = "..." # Audio URL, support aac, mp3, wav and ogg
playerCover = "..." # Audio cover
```
-### Image zoom and lazyload settings
+### 📷 Image zoom and lazyload settings
Zoomable, not lazyloaded:
@@ -123,7 +129,7 @@ Not zoomable, lazyloaded, optional ext link:
`img-lazy` will show a 16x9 placeholder before image is loaded, so `img-lazy-row` will show a 32x9 placeholder and `img-lazy-col` will show a 8x9 placeholder. You can choose different aspect ratios you want for different images. The placeholder image can be set in site's `config.toml`.
-### Markdown render hook
+### ⚓ Markdown render hook
You can create the files below in your site to adjust the markdown render hook, see [Hugo's Official Docs](https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks).
@@ -133,7 +139,7 @@ You can use `[SITEROOT]/layouts/_default/_markup/render-link.html` to decide whe
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a>
```
-### Comments area
+### 📨 Comments area
主题支持三种评论系统,Disqus、utterances 和 DisqusJS (给大陆用户的)。
@@ -146,15 +152,15 @@ You can check my blog for example of using DisqusJS and add more settings and ap
- [`config.toml`]()
- [`comment-disqusjs.html`]()
-### Load main CSS und JS from CDN
+### ⏱️ Load main CSS und JS from CDN
Without the demand of custmize the CSS, you can uncomment `mainAssetsCDN = true` in `config.toml` to load `fuji.min.css` and `fuji.min.js` from jsDelivr.
-### Advanced configuration
+### 🔧 Advanced configuration
See [Report und contributing](#report-und-contributing).
-## Report und contributing
+## ✏️ Report und contributing
Note that to keep the `master` branch clean, the main development work is made under `dev` branch. Please set base branch to `dev`, then make commitment or pull request.
@@ -178,7 +184,7 @@ Build:
npm run build
```
-## License
+## 📝 License
The theme is released under the ```Apache License 2.0```, for more information read the [License](https://github.com/amzrk2/hugo-theme-fuji/blob/master/LICENSE).
@@ -191,7 +197,7 @@ The theme is released under the ```Apache License 2.0```, for more information r
> © 2020 DSRKafuU(amzrk2) [Twitter](https://twitter.com/amzrk2) [GitHub]()
-## Annotations
+## 🤝 Annotations
Thanks to [community contributors](https://github.com/amzrk2/hugo-theme-fuji/graphs/contributors) for great help.
diff --git a/README_CN.md b/README_CN.md
index e31f3f4..2da3478 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -8,35 +8,34 @@
## 目录
-- [在线 Demo](#在线-demo)
-- [注意事项](#注意事项)
-- [开始使用](#开始使用)
-- [更新主题](#更新主题)
-- [自定义设置](#自定义设置)
- - [站点图标](#站点图标)
- - [关闭特定文章的 License 和评论](#关闭特定文章的-license-和评论)
- - [文章音乐](#文章音乐)
- - [图片放大的设置和 lazyload](#图片放大的设置和-lazyload)
- - [Markdown 钩子](#markdown-钩子)
- - [这字体也太丑了,换掉](#这字体也太丑了换掉)
- - [评论区](#评论区)
- - [通过 CDN 加载主 CSS 和 JS](#通过-cdn-加载主-css-和-js)
- - [其他高级修改](#其他高级修改)
-- [批判一番和贡献代码](#批判一番和贡献代码)
-- [License](#license)
-- [Annotations](#annotations)
-
-## 在线 Demo
+- [💻 在线 Demo](#在线-demo)
+- [❗ 注意事项](#注意事项)
+- [🐣 开始使用](#开始使用)
+- [🆕 更新主题](#更新主题)
+- [⚙️ 自定义设置](#自定义设置)
+ - [🎨 站点图标](#站点图标)
+ - [❌ 关闭特定文章的 License 和评论](#关闭特定文章的-license-和评论)
+ - [🎵 文章音乐](#文章音乐)
+ - [📷 图片放大的设置和 lazyload](#图片放大的设置和-lazyload)
+ - [⚓ Markdown 钩子](#markdown-钩子)
+ - [📨 评论区](#评论区)
+ - [⏱️ 通过 CDN 加载主 CSS 和 JS](#通过-cdn-加载主-css-和-js)
+ - [🔧 其他高级修改](#其他高级修改)
+- [👓 批判一番和贡献代码](#批判一番和贡献代码)
+- [📝 License](#license)
+- [🤝 Annotations](#annotations)
+
+## 💻 在线 Demo
[**在线 Demo (英文)**](https://themes.gohugo.io/theme/hugo-theme-fuji/) | [我的博客 (中文)](https://blog.amzrk2.cc/)
![Fuji 截图](https://raw.githubusercontent.com/amzrk2/hugo-theme-fuji/master/images/screenshot.png)
-## 注意事项
+## ❗ 注意事项
记得给文章添加 [简介分隔线](https://gohugo.io/content-management/summaries/#manual-summary-splitting) `<!--more-->`,以让文章列表的文章预览部分样式正确。
-## 开始使用
+## 🐣 开始使用
添加主题:
@@ -48,21 +47,21 @@ $ git submodule add https://github.com/amzrk2/hugo-theme-fuji.git themes/fuji
然后把 `exampleSite` 复制出来,并修改 `config.toml` 即可。
-## 更新主题
+## 🆕 更新主题
```bash
$ git submodule update --remote --merge
```
-## 自定义设置
+## ⚙️ 自定义设置
-### 站点图标
+### 🎨 站点图标
使用 `[SITEROOT]/layouts/partials/favicon.html` 来覆盖主题自带的图标。
可以在 [realfavicongenerator.net](https://realfavicongenerator.net/) 快速创建自己的图标。
-### 关闭特定文章的 License 和评论
+### ❌ 关闭 License 和评论
安全第一,在 front matter 里加上这些:
@@ -71,7 +70,13 @@ noLicense = true # 憋显示 License
noComments = true # 憋显示评论区
```
-### 文章音乐
+你也可以全局关闭 License 显示,在 `config.toml` 把下面这项设置为 false 或注释掉:
+
+```toml
+showLicense = false
+```
+
+### 🎵 文章音乐
支持给文章单独添加 APlayer,在 front matter 里加上这些:
@@ -82,7 +87,7 @@ playerURL = "..." # URL
playerCover = "..." # 封面
```
-### 图片放大的设置和 lazyload
+### 📷 图片放大的设置和 lazyload
可放大,非 lazyload:
@@ -114,7 +119,7 @@ playerCover = "..." # 封面
`img-lazy` 提供 16:9 的占位 svg,`img-lazy-row` 提供 32:9 的占位 svg,`img-lazy-col` 提供 8:9 的占位 svg。你也可以在 `config.toml` 里面自定义想要的占位图片和比例。
-### Markdown 钩子
+### ⚓ Markdown 钩子
具体内容看 [Hugo's Official Docs](https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks),用于配置 Markdown 解释器。
@@ -124,7 +129,7 @@ playerCover = "..." # 封面
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a>
```
-### 评论区
+### 📨 评论区
主题支持三种评论系统,Disqus、utterances 和 DisqusJS (给大陆用户的)。
@@ -137,15 +142,15 @@ playerCover = "..." # 封面
- [`config.toml`]()
- [`comment-disqusjs.html`]()
-### 通过 CDN 加载主 CSS 和 JS
+### ⏱️ 通过 CDN 加载主 CSS 和 JS
如果你不需要自行修改 CSS 和 JS,可以将 `config.toml` 内的 `mainAssetsCDN = true` 解除注释。`fuji.min.css` 和 `fuji.min.js` 将会从 jsDelivr 加载。
-### 其他高级修改
+### 🔧 其他高级修改
见[批判一番和贡献代码](#批判一番和贡献代码)。
-## 批判一番和贡献代码
+## 👓 批判一番和贡献代码
为了保证 `master` 分支干净,所有开发都是在 `dev` 分支进行的,记得对着 `dev` 分支批判。
@@ -169,7 +174,7 @@ npm run dev
npm run build
```
-## License
+## 📝 License
The theme is released under the ```Apache License 2.0```, for more information read the [License](https://github.com/amzrk2/hugo-theme-fuji/blob/master/LICENSE).
@@ -182,7 +187,7 @@ The theme is released under the ```Apache License 2.0```, for more information r
> © 2020 DSRKafuU(amzrk2) [Twitter](https://twitter.com/amzrk2) [GitHub]()
-## Annotations
+## 🤝 Annotations
Thanks to [community contributors](https://github.com/amzrk2/hugo-theme-fuji/graphs/contributors) for great help.
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 721671e..db5e2f5 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -16,7 +16,7 @@
</div>
</article>
<!-- post license -->
-{{ if ne .Params.noLicense true }}
+{{ if and (.Site.Params.showLicense) (ne .Params.noLicense true) }}
<div class="license markdown-body">
<blockquote>
<p>{{ i18n "postCopyrightFront" }}<a rel="license" href="{{ .Site.Params.licenseLink }}"