提交 62b82fbd 编写于 作者: EvanOne(文一)'s avatar EvanOne(文一)

docs: Update docs & remove en docs

上级 33b1d1a4
# Primary Setting
::: tip Preface
- Modifying configuration files, installing new dependencies, etc. all require restarting the Hexo server.
- Not specifically, configuration items are supported from `v1.0.0`.
- Stable configuration is indicated by <Badge text="Stable"/>, which means it will not change basically. Unstable configurations are indicated by <Badge text="Beta" type="warn"/>, which means it may be changed or even deleted in the future. Configuration items that are not supported currently are indicated by <Badge text="Not Support" type="error"/>. Abandon configurations are indicated by <Badge text="Abandon" type="error"/>. The earliest supported version number are indicated by <Badge text="v x.x.x"/>. Configuration items that are not related to the subject are indicated by <Badge text="Disrelated" type="warning"/>.
:::
## Configuration file
First, you need to distinguish between the following two configuration files:
- `_config.yml` in the root directory of Hexo. This is the Hexo configuration file, which is configured for the entire site.
- `_config.yml` in the root directory of Stun. This is the theme configuration file, and the configuration inside is only valid for the current theme.
As for the configuration, which configuration file needs to be modified, it will be pointed out in the documentation.
## Add new page <Badge text="Stable"/>
The Stun theme has built-in: category page, tag page. It is not enabled by default. To enable these pages, you need to follow these steps:
1. Execute the command in the Hexo root directory
``` bash
# Enable the category page, execute this command
$ hexo new page categories
# Enable the tag page, execute this command
$ hexo new page tags
```
2. Modify Front-Matter
Find the Markdown file in the `source/categories` or `source/tags` folder in the Hexo root directory and add Front-Matter:
``` yaml
# If it is a category page, add this
type: "categories"
# If it is a tag page, add this
type: "tags"
```
3. Then modify the theme configuration file to uncomment the `categories` or `tags` counterparts
``` yaml
menu:
# `||` The separator is preceded by a path, followed by the Font Awesome icon name
# If you don't need to use the icon, just fill in the path.
home: / || home
archives: /archives/ || folder-open
# categories: /categories/ || th
# tags: /tags/ || tags
# xxx: /xxx/ || xxx
```
In addition to using the above built-in page, if you want to use a custom page, you need to perform the following steps:
Take the Add **Read** page as an example.
1. Modify the theme configuration file and add the corresponding menu item
``` yaml
menu:
# Format is as follows
# Name: Path || Icon Name
reading: /reading/ || book
```
> The name of the icon is available here: [https://fontawesome.com/v4.7.0/icons/](https://fontawesome.com/v4.7.0/icons/).
2. Create a page file
Execute the command in the Hexo root directory:
``` bash
$ hexo new page reading # 'reading' is the path you set
```
1. Internationalization
Find the language files in the `languages` directory and select the language you use for your website. Here is an example of Engligh:
`en.yml`:
``` yaml
menu:
reading: reading
```
This completes the addition of custom pages.
Alternatively, you can set whether the icon and text are displayed by modifying the `menu_settings` field in the theme configuration file:
``` yaml
menu_settings:
# Only show by icon.
icon_only: false
# Only show by text.
text_only: false
```
## Favicon <Badge text="Stable"/>
The theme uses Stun's Logo as the website icon by default, you need to switch to your own.
It is recommended that you create a new folder in the `source` directory under the **Hexo root directory** for placing images, such as `assets`, and then you can use the image with a path like `/assets/xxx.png`. Fill in the image path to your theme profile:
``` yaml
favicon:
small: /images/icons/favicon-16x16.png
medium: /images/icons/favicon-32x32.png
# ! -----------------------------------------------------
# ! If you don't understand, please ignore the following.
# ! -----------------------------------------------------
# apple_touch_icon: /images/icons/apple-touch-icon.png
# safari_pinned_tab: /images/icons/stun-logo.svg
# msapplication: /images/icons/favicon-144x144.png
```
> You can also place images in the `source` directory under the **Themes directory**, but this is not recommended as it may overwrite your files when updating the theme.
## Setting header
### Header <Badge text="Stable"/>
If you want to set the height of the top bar of the site, the height of the navigation bar, the background image, you need to modify the theme profile:
``` yaml
header:
# Header height (Support for all types of CSS size units).
height: 80%
# Header navigation bar height (Support for all types of CSS size units).
nav_height: 50px
# Background image in the header.
bg_image:
enable: false
# In theme directory (source/images): /images/avatar.png
# In site directory (source/uploads): /uploads/avatar.png
# You can also use a link of image.
url:
# Mask effect of the background image.
mask:
enable: false
# Opacity of mask (value: 0 ~ 1).
opacity: 0.5
# The icon that prompt to scroll down.
scroll_down_icon:
enable: false
animation: true
```
::: warning Note
- The `mask` option, the mask effect, is supported starting with the `v1.1.1` version. The `blur_effect` option, the blur filter effect, is abandoned starting with the `v1.1.1` version.
- The `scroll_down_icon` option is supported starting with the `v1.5.4` version.
:::
### Specify the top image <Badge text="Stable"/>
If you want to specify a top image for a page or an article separately, you need [Front-Matter](https://hexo.io/zh-cn/docs/Front-Matter) on the page or article Markdown source file. In the middle, add the `top_image` item, and then fill in the image url or path. e.g.:
``` yaml
---
title: Hello Stun
date: 2019-05-15 22:54:49
top_image: https://xxxxx.jpg
---
```
## Setting sidebar
### Author <Badge text="Stable"/>
The default avatar in the sidebar is Stun's Logo, you need to change it to your own, modify the theme configuration file:
``` yaml
author:
enable: true
# Avatar in the sidebar.
avatar:
# In theme directory (source/images): /images/avatar.png
# In site directory (source/uploads): /uploads/avatar.png
# You can also use a link of image.
url: /images/avatar.png
# If true, the avatar would be displayed in a circle.
rounded: false
# The value should be chosen from 0 to 1.
opacity: 1
# Mouse hover animation, available value: turn | shake.
animation: turn
# Your favorite motto.
motto: hello world
```
### Social link <Badge text="Stable"/>
Modify the theme configuration file:
``` yaml
# Value before `||` delimiter is the target link.
# Value after `||` delimiter is the name of FontAwesome icon.
# See: https://fontawesome.com/v4.7.0/icons/
# If you can`t find a suitable icon, you can choose to display the original
# text by adding the "origin" prefix (e.g. origin:sf, then "sf" will be show).
social:
github: https://github.com/ || github
google: https://plus.google.com/ || google
# twitter: https://twitter.com/ || twitter
# youtube: https://youtube.com/ || youtube
# segmentfault: https://segmentfault.com/ || origin:sf
# weibo: https://weibo.com/ || weibo
# zhihu: https://www.zhihu.com/ || origin:知
# wechat: yournumber || weixin
# telegram: yournumber || telegram
# qq: yournumber || qq
# xxx: xxx || (origin:)xxx
social_setting:
enable: false
# Only show by icon.
icon_only: true
```
> If you don't want to enable a social link, just comment it out.
>
> The name of the icon is found here: [https://fontawesome.com/v4.7.0/icons/](https://fontawesome.com/v4.7.0/icons/)
::: danger <Badge text="Abandon" type="error"/>
The `text_align` attribute of the configuration item `social_setting` is removed in the `v1.2.0` version.
:::
When you add a social link that is not available by default, you need to set it internationally. Here to add the link `Nuggets' as an example, the steps are as follows:
1. Modify the theme configuration file
``` yaml
social:
juejin: https://juejin.im/timeline || origin:Jue
```
2. Internationalization
Find the language files in the `languages` directory and select the language you use for your website. Here is an example of Engligh:
`en.yml`:
``` yaml
social:
juejin: JueJin
```
The effect is as follows:
![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20190717165333.png)
## Article Summary <Badge text="Stable"/>
If you want to keep the article summary, you need to **manually** add the `<!-- more -->` tag to the article's Markdown source file. The part before the markup is retained as an article summary, which is displayed in the article list.
If you want to automatically keep the article summary, you can modify the theme profile:
``` yaml
auto_excerpt:
enable: false
length: 150
```
> Since the effect of automatically retaining the summary is not ideal, it is not recommended to open it here.
## Enable Appreciation Code <Badge text="Stable"/>
If you want to enable the rewarded QR code at the bottom of the article, you need to modify the theme profile:
``` yaml
reward:
enable: true
alipay: https://xxxxx.png
wechat: https://xxxxx.png
```
The effect is as follows:
![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20190608175556.png)
You can set `reward: false` in `Front-Matter` in the article Markdown source file to specify that an article does not have the appreciation code enabled.
::: warning Note
If `reward` is not enabled in the theme configuration file, setting the article `reward: true` separately has no effect.
:::
---
The most basic configuration is done here. If you want to configure the theme in more detail, please continue reading the documentation.
> Documentation is writing...
......@@ -2,7 +2,7 @@
## Installation
- Install `stun`
- Install `Stun`
Enter your hexo directory, run this.
......@@ -10,7 +10,7 @@
$ git clone https://github.com/liuyib/hexo-theme-stun.git themes/stun
```
- Install dependency `pug`
- Install dependency `hexo-render-pug`
Enter your hexo directory, run this.
......@@ -37,9 +37,9 @@ $ hexo clean && hexo s
``` bash
$ cd themes/stun
# Update to stable version (recommend).
# Update to stable version (Recommend).
$ git pull origin master
# Update to the latest features (May be unstable and not recommended).
# Update to the latest features (Not recommended).
$ git pull origin dev
```
......@@ -53,7 +53,7 @@ layout:
``` yaml
layout:
# 网站内容区域宽度(显示文章的区域)
content: 768px
content: 760px
# 侧边栏宽度
sidebar: 300px
# 内容区域和侧边栏之间的间隙
......@@ -85,13 +85,12 @@ layout:
``` yaml
night_mode:
# 是否启用
enable: true
# 切换夜晚模式的按钮
button:
# 按钮块的颜色
# 按钮块的颜色(请使用引号包裹值)
color: "#fafafa"
# 按钮的背景颜色
# 按钮的背景颜色(请使用引号包裹值)
bg_color: "#8c8a8a"
# 代表白天和夜晚的图标(目前仅支持文本和 emoji)
icon:
......@@ -134,13 +133,13 @@ Hexo 会使用 git commit 中,文件的最新提交时间作为更新日期,
```
---
title: Hello Stun
comments: false # 不启用评论
comments: false
---
```
- `excerpt` <Badge text="Hexo v4.0.0"/> - 指定文章摘要
Hexo 3.9 及以前的版本中,只能通过添加 `<!-- more -->` 标记来保留文章摘要(当然 Stun 主题也提供了[自动保留摘要](http://liuyib.github.io/hexo-theme-stun/zh-CN/guide/primary-setting.html#文章摘要)的功能)。在 Hexo 4.0.0 及以后的版本中,可以通过在 Front-Matter 中使用 `excerpt` 来设置文章摘要。例如:
Hexo 3.9.0 及以前的版本中,只能通过添加 `<!-- more -->` 标记来保留文章摘要。在 Hexo 4.0.0 及以后的版本中,可以通过在 Front-Matter 中使用 `excerpt` 来设置文章摘要。例如:
```
---
......@@ -227,9 +226,7 @@ Hexo 会使用 git commit 中,文件的最新提交时间作为更新日期,
可以看到,设置了 `layout: false` 后,只将 Markdown 解析成 HTML,不做其他处理。
- 在 Front-Matter 中设置了 `layout: true` 或 默认情况
![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20190820175119.png)
- 在 Front-Matter 中设置了 `layout: true` 等价于 默认
---
......@@ -258,7 +255,6 @@ Hexo 会使用 git commit 中,文件的最新提交时间作为更新日期,
``` yaml
gallery_waterfall:
# 是否启用
enable: false
# 瀑布流中每一列的宽度
col_width: 220px
......@@ -273,7 +269,6 @@ Hexo 会使用 git commit 中,文件的最新提交时间作为更新日期,
![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20190724170138.png)
::: tip
- 启用瀑布流效果后,还可以再启用 [fancybox 效果](https://liuyib.github.io/hexo-theme-stun/zh-CN/advanced/assist.html#fancybox)。
- 可以利用这个属性,来建立一个**相册页面**或**展示图片的文章**。例如:[https://liuyib.github.io/gallery/](https://liuyib.github.io/gallery/)
:::
......@@ -332,52 +327,53 @@ Hexo 会使用 git commit 中,文件的最新提交时间作为更新日期,
## 二级导航栏菜单 <Badge text="Stable"/> <Badge text="v1.2.4"/>
如果想要使用二级导航栏菜单,你需要修改主题配置文件:
启用二级导航栏菜单,需要修改主题配置文件:
1. 修改 `menu` 字段
1. 修改 `menu` 配置项
``` yaml
menu:
# 格式如下
# 名称: javascript:; || 图标
xxx: javascript:; || xxx
# `||` 分隔符之前是占位符,`||` 分隔符之后是图标
# 用法(有图标): `Key: javascript:; || fa(s|r|l|d|b) fa-图标名称`
# 用法(无图标): `Key: javascript:;`
# fas far fal fad fab 是 FontAwesome 5.x 中图标的前缀,你需要根据具体图标自行设置
xxx1: javascript:; || fa(s|r|l|d|b) fa-xxx
```
> 在 `||` 符号之前,你必须使用 `javascript:;`(字母全小写)作为占位符。
2. 修改 `submenu` 字段
2. 修改 `submenu` 配置项
``` yaml
submenu:
xxx: # 这里的 xxx 与上述名称对应
xx1: /xx1/ || xx1 # 这里是子项,填写的值是:路径 || 图标
xx2: /xx2/ || xx2 # 这里是子项,填写的值是:路径 || 图标
# 这里的 xxx1 与上述名称对应
xxx1:
xxx1-1: /xxx1-1/ || fa(s|r|l|d|b) fa-xxx
xxx1-2: /xxx1-2/ || fa(s|r|l|d|b) fa-xxx
```
3. 国际化设置
找到 `languages` 目录下的语言文件,选择你网站使用的语言进行修改,这里以中文作为举例
找到 `languages` 目录下的语言文件,根据你网站使用的语言选择对应的语言文件,例如
`zh-CN.yml`:
``` yaml
xxx: 这是xxx对应的中文
xx1: 这是xx1对应的中文
xx2: 这是xx2对应的中文
xxx1: 这是 xxx1 对应的中文
xxx1-1: 这是 xxx1-1 对应的中文
xxx1-2: 这是 xxx1-2 对应的中文
```
举例,添加一个朋友链接的二级菜单:
例如,添加一个友情链接的二级菜单:
1. 修改主题配置文件
``` yaml
menu:
friends: javascript:; || users
friends: javascript:; || fas fa-users
submenu:
friends:
aaa: /aaa/ || male
bbb: /bbb/ || female
aaa: /aaa/ || fas fa-male
bbb: /bbb/ || fas fa-female
```
2. 国际化设置
......@@ -402,7 +398,6 @@ Hexo 会使用 git commit 中,文件的最新提交时间作为更新日期,
``` yaml
# Reward
reward:
# 是否启用
enable: false
# 支付宝
alipay: https://xxxxx.png
......@@ -425,7 +420,6 @@ reward:
``` yaml
creative_commons:
# 是否启用
enable: true
# 可选值: BY | BY-SA | BY-ND | BY-NC | BY-NC-SA | BY-NC-ND
# 详情请访问: https://creativecommons.org/share-your-work/licensing-types-examples/
......@@ -434,7 +428,11 @@ creative_commons:
sidebar: true
# 是否在文章底部显示
post: true
# 设置许可协议的显示语言,不设置默认为:en(当用户查看许可协议时,会以你设置的语言进行显示)
# 可选值:
# id | ms | ca | da | de | en | es | es_ES | eo | eu | fr | gl | hr
# it | lv | lt | hu | nl | no | pt | pt_BR | pl | ro | sl | fi | sv
# tr | is | cs | el | be | ru | zh | zh_TW | uk | ar | fa | bn | ja | ko
# 不设置默认为:en(当用户查看许可协议时,会以你设置的语言进行显示)
language:
```
......@@ -452,7 +450,6 @@ creative_commons:
``` yaml
toc:
# 是否启用
enable: true
# 是否自动添加列表序号
list_number: true
......@@ -480,7 +477,6 @@ toc:
``` yaml
feed:
# 是否启用
enable: false
# 邮件订阅地址 (例如:http://eepurl.com/guAE6j)
email:
......@@ -514,9 +510,8 @@ feed:
``` yaml
reading_progress:
# 是否启用
enable: true
# 请使用引号包裹颜色值(支持所有 CSS 颜色单位)
# 请使用引号包裹值(支持所有 CSS 颜色单位)
color: "#fc6423"
# 进度条高度(支持所有 CSS 长度单位)
height: 1px
......@@ -536,24 +531,21 @@ post_meta:
icon_only: false
# 文章创建时间
created:
# 是否启用
enable: true
# 图标名称在这里查找:https://fontawesome.com/v4.7.0/icons/
icon: calendar-o
# 查找图标名称,请访问:https://fontawesome.com/icons
icon: far fa-calendar-plus
# 文章更新时间
updated:
# 是否启用
enable: true
# 图标名称在这里查找
icon: calendar-check-o
# 查找图标名称,请访问:https://fontawesome.com/icons
icon: far fa-calendar-check
# 文章预计的阅读时间
# 启用这个功能之前,你首先需要在 Hexo 根目录安装依赖:
# `npm install hexo-wordcount --save`,然后重启 hexo 服务器
reading_time:
# 是否启用
enable: false
# 图标名称在这里查找
icon: clock-o
# 查找图标名称,请访问:https://fontawesome.com/icons
icon: far fa-clock
# 设置文章的阅读速度(阅读时间会根据这个设置来计算)
speed:
# 中文的阅读速度
......@@ -564,10 +556,9 @@ post_meta:
# 启用这个功能之前,你首先需要在 Hexo 根目录安装依赖:
# `npm install hexo-wordcount --save`,然后重启 hexo 服务器
word_count:
# 是否启用
enable: false
# 图标名称在这里查找
icon: file-word-o
# 查找图标名称,请访问:https://fontawesome.com/icons
icon: far fa-file-word
```
效果如下:![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20190619210334.png)
......@@ -585,9 +576,9 @@ post_meta:
``` yaml
# 分页设置
post_list_paged:
# 首页的文章列表是否分页
# 首页的文章列表是否分页
home: true
# 归档页面的文章列表是否分页
# 归档页面的文章列表是否分页
archives: false
```
......@@ -679,7 +670,6 @@ post_widget:
``` yaml
# 在文章底部显示 “本文结束” 的提示信息
post_end:
# 是否启用
enable: true
# 是否在提示信息之前显示水平分割线
horizon_line: true
......@@ -691,7 +681,6 @@ post_end:
post_widget:
# 在文章底部显示 “本文结束” 的提示信息
end_text:
# 是否启用
enable: true
# 是否在提示信息之前显示水平分割线
horizon_line: true
......@@ -716,12 +705,11 @@ $ npm install hexo-generator-index-pin-top --save
stick_top:
# 图标的位置(可选值为:left 和 right)
position: right
# 建议使用名为 `thumb-tack` 的图标
# 图标名称在这里查找:https://fontawesome.com/v4.7.0/icons/
icon: thumb-tack
# 查找图标名称,请访问:https://fontawesome.com/icons
icon: fas fa-thumbtack
# 图标的旋转角度(角度的单位是:deg)
rotate: 45deg
# 请使用引号包裹颜色值(支持所有 CSS 颜色单位)
# 请使用引号包裹值(支持所有 CSS 颜色单位)
color: "#999"
```
......@@ -856,9 +844,9 @@ tag_cloud:
# 请使用引号包裹颜色值(只支持十六进制的颜色值)
start_color: "#a4d8fa"
end_color: "#49b1f5"
# 标签最大、最小的尺寸
min_size: 24
max_size: 34
# 标签最大、最小的尺寸(例如:设置为 20 表示 字体大小 20px)
min_size: 16
max_size: 26
# 最大显示标签数量
max_amount: 200
```
......@@ -910,12 +898,10 @@ tag_cloud:
``` yaml
external_link:
icon:
# 是否启用
enable: true
# 建议使用名为 `external-link` 的图标
# 图标名称在这里查找:https://fontawesome.com/v4.7.0/icons/
name: external-link
# 请使用引号包括值(支持所有 CSS 单位)
# 查找图标名称,请访问:https://fontawesome.com/icons
name: fas fa-external-link-alt
# 请使用引号包裹值(支持所有 CSS 颜色单位)
color: "#aaa"
```
......@@ -935,15 +921,14 @@ fancybox: true
### 图片放大效果 <Badge text="Stable"/> <Badge text="v1.2.0"/>
Stun 主题从 `v1.2.0` 版本开始支持图片点击放大的效果(无第三方依赖)。你可以配置该功能,修改主题配置文件:
Stun 主题从 `v1.2.0` 版本开始支持图片点击放大的效果。你可以配置该功能,修改主题配置文件:
``` yaml
zoom_image:
# 是否启用
enable: true
# 遮罩的颜色
# 遮罩的颜色(请使用引号包裹值)
mask_color: "rgba(0,0,0,0.6)"
# 图片放大时,距离屏幕边缘的间隙
# 图片放大时,距离屏幕边缘的间隙(只支持 px 单位)
gap_aside: 20px
```
......@@ -957,7 +942,6 @@ Stun 主题从 `v1.2.0` 版本开始支持图片懒加载,但是**该功能只
``` yaml
lazyload:
# 是否启用
enable: true
# 图片未加载前的占位符。可选值有:gif 或 block
placeholder: gif
......
......@@ -390,18 +390,18 @@ busuanzi:
# 统计站点 UV 数量
site_uv:
enable: true
# FontAwesome 图标名称: https://fontawesome.com/v4.7.0/icons/
icon: user
# 查找图标名称,请访问:https://fontawesome.com/icons
icon: fas fa-user
# 统计站点 PV 数量
site_pv:
enable: true
# FontAwesome 图标名称: https://fontawesome.com/v4.7.0/icons/
icon: eye
# 查找图标名称,请访问:https://fontawesome.com/icons
icon: fas fa-eye
# 统计每篇文章的 PV 数量
post_pv:
enable: true
# FontAwesome 图标名称: https://fontawesome.com/v4.7.0/icons/
icon: eye
# 查找图标名称,请访问:https://fontawesome.com/icons
icon: fas fa-eye
```
### 谷歌分析 <Badge text="Stable"/> <Badge text="v1.2.4"/>
......@@ -779,7 +779,6 @@ MathJax 与 KaTex 相比之下,[KaTex 引擎速度更快](https://www.intmath.
``` yaml
math:
...
# 字母全小写
engine: mathjax
```
......@@ -820,7 +819,6 @@ $ npm un hexo-math --save
``` yaml
math:
...
# 字母全小写
engine: katex
```
......@@ -904,7 +902,7 @@ canvas_nest:
enable: false
# 是否在移动端显示
onmobile: true
# 线条的颜色(RGB 值,请使用 "," 分隔)
# 线条的颜色(RGB 值,请使用 "," 分隔,并用引号包裹值
color: "0,0,0"
# 线条的透明度
opacity: 0.6
......
......@@ -10,16 +10,18 @@
首先,你需要分清下面这两个配置文件的作用:
- Hexo 根目录下的 `_config.yml`。这是 Hexo 配置文件,里面的配置作用于整个网站
- Stun 根目录下的 `_config.yml`。这是主题配置文件,里面的配置只对当前主题生效。
- Hexo 根目录下的 `_config.yml`。这是 Hexo 配置文件,其配置对整个网站生效
- Stun 根目录下的 `_config.yml`。这是主题配置文件,其配置只对主题生效。
至于配置的时候,需要修改哪一个配置文件,文档里会指出
在接下来的文档中,会说明你应该修改哪一个配置文件
## 添加新页面 <Badge text="Stable"/>
Stun 主题内置有:分类页、标签页。默认没有启用。想启用这些页面,需要按照如下步骤操作
Stun 主题内置有:分类页、标签页。默认没有启用。如果想启用它们,你需要执行以下步骤
1. 在 Hexo 根目录下执行命令
1. 执行命令
在 Hexo 根目录下:
``` bash
# 启用分类页,执行这条指令
......@@ -31,57 +33,58 @@ Stun 主题内置有:分类页、标签页。默认没有启用。想启用这
2. 修改 Front-Matter
找到 Hexo 根目录下的 `source/categories` 或 `source/tags` 文件夹中的 Markdown 文件,添加 Front-Matter:
在 Hexo 根目录下,找到 `source/categories` 或 `source/tags` 文件夹中的 Markdown 文件,设置 Front-Matter:
```
---
# 如果是分类页,添加这个
# 如果是分类页,设置这个
type: "categories"
# 如果是标签页,添加这个
# 如果是标签页,设置这个
type: "tags"
---
```
3. 然后修改主题配置文件,将 `categories``tags` 对应项取消注释
3. 修改主题配置文件
将 `categories` 或 `tags` 对应项取消注释:
``` yaml
# `||` 分隔符之前是页面路径,`||` 分隔符之后是图标
# 用法(有图标): `Key: /路径/ || fa(s|r|l|d|b) fa-图标名称`
# 用法(无图标): `Key: /路径/`
# fas far fal fad fab 是 FontAwesome 5.x 中图标的前缀,你需要根据具体图标自行设置
# 查找图标名称,请访问:https://fontawesome.com/icons
menu:
# `||` 分隔符前面表示路径,后面表示 Font Awesome 图标名称
# 如果不需要使用图标,直接填写路径即可
home: / || home
archives: /archives/ || folder-open
# categories: /categories/ || th
# tags: /tags/ || tags
# xxx: /xxx/ || xxx
home: / || fas fa-home
archives: /archives/ || fas fa-folder-open
# categories: /categories/ || fas fa-layer-group
# tags: /tags/ || fas fa-tags
```
除了使用上述内置页面外,如果你想使用自定义页面,需要执行如下步骤:
如果你想添加自定义页面,需要执行以下步骤:
以添加**阅读**页面为例。
1. 修改主题配置文件,添加相应的菜单项
1. 修改主题配置文件
``` yaml
menu:
# 格式如下
# 名称: 路径 || 图标名称
reading: /reading/ || book
reading: /reading/ || fas fa-book
```
> 图标的名称在这里获取:[https://fontawesome.com/v4.7.0/icons/](https://fontawesome.com/v4.7.0/icons/)。
2. 创建页面文件
2. 生成页面文件
在 Hexo 根目录下执行指令:
``` bash
$ hexo new page reading # 这里的 reading 对应上一步你设置的路径名称
# 这里的 reading 对应上一步你设置的路径名称
$ hexo new page reading
```
3. 国际化设置
找到 `languages` 目录下的语言文件,选择你网站使用的语言进行修改,这里以中文作为举例
找到 `languages` 目录下的语言文件,根据你网站使用的语言选择对应的语言文件,例如
`zh-CN.yml`:
......@@ -90,9 +93,9 @@ Stun 主题内置有:分类页、标签页。默认没有启用。想启用这
reading: 阅读
```
这样就完成了自定义页面的添加
这样就添加好了自定义页面
另外,你可以通过修改主题配置文件里的 `menu_settings` 字段,来设置图标和文字是否显示:
另外,你可以通过修改主题配置文件里的 `menu_settings` 选项,来设置图标和文字是否显示:
``` yaml
menu_settings:
......@@ -104,15 +107,17 @@ menu_settings:
## Favicon <Badge text="Stable"/>
刚开始,主题默认使用 Stun 的 Logo 作为网站图标,你需要换成自己的。
主题默认使用 Stun 的 Logo 作为网站图标,你需要换成自己的。
建议你在 **Hexo 根目录**下的 `source` 目录中,新建一个文件夹用于放置图片,例如 `assets`,然后你可以通过 `/assets/xxx.png` 这样的路径使用图片。将图片路径填入你的主题配置文件:
建议你在 **Hexo 根目录**下的 `source` 目录中,新建一个文件夹用于放置图片,例如 `assets`,然后你可以通过 `/assets/xxx.png` 这样的路径使用图片。将图片路径填入你的主题配置文件:
``` yaml
favicon:
small: /assets/favicon-16x16.png # 16x16 像素大小的图片
medium: /assets/favicon-32x32.png # 32x32 像素大小的图片
# 下面这些配置项默认不启用,你需要准备好相应的图片后再开启,也可以直接忽略。
# ! -----------------------------------------------------------------------
# 下面这些配置项默认不启用,你需要准备好相应的图片后才能启用,也可以直接忽略。
# ! -----------------------------------------------------------------------
# apple_touch_icon: /assets/apple-touch-icon.png # 180x180 像素大小的图片
# safari_pinned_tab: /assets/stun-logo.svg # SVG 格式的图片
# msapplication: /assets/favicon-144x144.png # 144x144 像素大小的图片
......@@ -124,7 +129,6 @@ favicon:
``` yaml
header:
# 是否启用
enable: true
show_on:
# 在文章页面是否显示网站顶部
......@@ -133,13 +137,11 @@ header:
height: 80%
# 顶部背景图片
bg_image:
# 是否启用
enable: false
# 填写图片路径或链接
url: https://xxxxx.png
url:
# 顶部背景图的遮罩效果
mask:
# 是否启用
enable: false
# 透明度(取值:0 ~ 1)
opacity: 0.5
......@@ -150,19 +152,18 @@ header:
bg_color: "#333"
# 提示向下滚动的图标
scroll_down_icon:
# 是否启用
enable: false
# 查找图标名称,请访问:https://fontawesome.com/icons
name: fas fa-angle-down
# 是否启用动画
animation: true
```
其中 `header.enable``header.show_on.post` 选项,默认都为 `true`
- 如果设置 `header.enable: false`,则所有页面中都不显示 header(只显示顶部导航栏),效果如下:
- 如果设置 `header.enable: false`,则所有页面中都不显示网站 Header(只显示顶部导航栏)。效果如下:
![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20200203194337.jpg)
- 如果设置 `header.enable: true``header.show_on.post: false`,则文章页不显示 header,其他页面仍会显示 header,效果如下:
- 如果设置 `header.enable: true``header.show_on.post: false`,则文章页不显示网站 Header,其它页面仍会显示。效果如下:
**文章页:**
......@@ -173,18 +174,20 @@ header:
![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20200203194338.jpg)
::: warning
- `mask` 选项 <Badge text="v1.1.1"/>
- `blur_effect` 选项 <Badge text="Abandon" type="error"/> <Badge text="v1.1.1" type="error"/>
- `scroll_down_icon` 选项 <Badge text="v1.5.4"/>
- `nav_height` 选项 <Badge text="v1.0.0"/>,在 `v1.7.0` 版本修改为 `nav`
- `header.enable``show_on` 选项 <Badge text="v1.7.0"/>
下面是一些选项的版本支持情况和注意事项:
- `header.mask` <Badge text="v1.1.1"/>
- `header.blur_effect` <Badge text="v1.1.1" type="error"/> <Badge text="Abandon" type="error"/>
- `header.scroll_down_icon` <Badge text="v1.5.4"/>
- `header.nav_height` <Badge text="v1.0.0"/>,修改于 <Badge text="v1.7.0"/>
- `header.enable` <Badge text="v1.7.0"/>`header.show_on` <Badge text="v1.7.0"/>
> 当 `header.enable` 和 `show_on` 两者之一设为 `false` 或都设为 `false` 时,不兼容 Pjax 功能中的 `scrollTo2screen` 选项。
> 当 `header.enable` 或 `header.show_on` 被设为 `false` 时,不兼容 `pjax.scrollTo2screen` 选项。
:::
### 指定顶部图 <Badge text="Stable"/>
如果想要为某个页面或某篇文章单独指定顶部图,你需要在页面或文章 Markdown 源文件的 [Front-Matter](https://hexo.io/zh-cn/docs/Front-Matter) 中,添加 `top_image` 项,然后填入的图片 url 或路径即可。例如:
如果想要为某个页面或某篇文章指定顶部图,你需要在页面或文章 Markdown 源文件的 [Front-Matter](https://hexo.io/zh-cn/docs/Front-Matter) 中,添加 `top_image` 选项,然后填入的图片路径或链接即可。例如:
```
---
......@@ -201,17 +204,15 @@ top_image: https://xxxxx.jpg
body:
# 网站主体背景图片
bg_image:
# 是否启用
enable: false
# 填写图片路径或链接
url: https://xxxxx.png
# 是否固定背景图片(相当于设置 position: fixed)
# 是否固定背景图片(相当于设置 CSS 属性 position: fixed)
fixed: true
# 图片无法占满空间时,是否重复显示(相当于设置 background-repeat: repeat/no-repeat)
# 是否重复显示背景图片(相当于设置 CSS 属性 background-repeat: repeat/no-repeat)
repeat: false
# 网站主体背景图片的遮罩效果
mask:
# 是否启用
enable: false
# 透明度(取值:0 ~ 1)
opacity:
......@@ -227,7 +228,6 @@ body:
``` yaml
sidebar:
# 是否启用
enable: true
# 侧边栏位置,可选值有:left 或 right
position: right
......@@ -238,7 +238,7 @@ sidebar:
```
::: danger <Badge text="Abandon" type="error"/>
其中的 `width` 属性在 `v1.6.0` 版本废弃。替代的设置是 `layout.sidebar` 属性
其中,配置项 `sidebar.width` 在 `v1.6.0` 版本废弃。代替的配置是 `layout.sidebar`
:::
### 作者信息 <Badge text="Stable"/>
......@@ -247,18 +247,17 @@ sidebar:
``` yaml
author:
# 是否启用
enable: true
# 侧边栏头像
avatar:
# 填写图片路径或链接
url: https://xxx.png
url: https://xxxxx.png
# 是否显示为圆形
rounded: true
# 头像透明度(取值:0 ~ 1)
opacity: 1
# 鼠标 hover 动画,可选值:trun或 shake
animation: trun
# 鼠标经过时的动画,可选值:turn 或 shake
animation: turn
# 格言(可以是任意一句想写的话)
motto: hello world
```
......@@ -268,22 +267,25 @@ author:
修改主题配置文件:
``` yaml
# `||` 分隔符前面表示社交链接的 URL 或信息,后面表示 Font Awesome 图标
# 如果你找不到想要的图标,可以考虑用文字来代替图标显示
# 通过添加 `origin:` 前缀即可显示文字。例如:`origin:知` 会以 `知` 代替图标显示
# `||` 分隔符之前是具体链接,`||` 分隔符之后是图标。
# 用法(有图标): `Key: /路径/ || fa(s|r|l|d|b) fa-图标名称`
# 用法(无图标): `Key: /路径/`
# fas far fal fad fab 是 FontAwesome 5.x 中图标的前缀,你需要根据具体图标自行设置。
# 查找图标名称,请访问:https://fontawesome.com/icons
#
# 如果你找不到想要的图标,可以考虑用文字来代替图标显示,用法:
# 通过添加 `origin:` 前缀即可显示文字。例如:`origin:知` 会以 `知` 代替图标显示。
social:
github: https://github.com/ || github
google: https://plus.google.com/ || google
# twitter: https://twitter.com/ || twitter
# youtube: https://youtube.com/ || youtube
github: https://github.com/ || fab fa-github
google: https://plus.google.com/ || fab fa-google
twitter: https://twitter.com/ || fab fa-twitter
youtube: https://youtube.com/ || fab fa-youtube
# segmentfault: https://segmentfault.com/ || origin:sf
# weibo: https://weibo.com/ || weibo
# weibo: https://weibo.com/ || fab fa-weibo
# zhihu: https://www.zhihu.com/ || origin:知
# wechat: yournumber || weixin
# telegram: yournumber || telegram
# qq: yournumber || qq
# 你可以自行添加这里没有的社交链接,格式如下:
# xxx: xxx || (origin:)xxx
# wechat: yournumber || fab fa-weixin
# telegram: yournumber || fab fa-telegram
# qq: yournumber || fab fa-qq
# 社交链接的设置
social_setting:
......@@ -293,12 +295,8 @@ social_setting:
icon_only: true
```
> 如果不想启用某个社交链接,直接注释掉即可。
>
> 图标的名称在这里查找:[https://fontawesome.com/v4.7.0/icons/](https://fontawesome.com/v4.7.0/icons/)
::: danger <Badge text="Abandon" type="error"/>
其中,配置项 `social_setting` 的 `text_align` 属性在 `v1.2.0` 版本废弃。
其中,配置项 `social_setting.text_align` 在 `v1.2.0` 版本废弃。
:::
当你添加一个默认没有的社交链接时,需要进行国际化设置。这里以添加链接 `掘金` 为例,步骤如下:
......@@ -310,11 +308,9 @@ social_setting:
juejin: https://juejin.im/timeline || origin:掘
```
> 由于 Font Awesome 4.0 中找不到掘金的 logo,所以这里使用 `掘` 字来代替显示。
2. 国际化设置
找到 `languages` 目录下的语言文件,选择你网站使用的语言进行修改,这里以中文作为举例
找到 `languages` 目录下的语言文件,根据你网站使用的语言选择对应的语言文件,例如
`zh-CN.yml`:
......@@ -323,11 +319,11 @@ social_setting:
juejin: 掘金
```
> 这里的国际化设置,对应鼠标经过图标时,显示的文字。
> 这里的国际化设置,对应鼠标经过图标时,显示的文字。
效果如下:
效果如下:
![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20190717165333.png)
![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20190717165333.png)
## 网站底部设置 <Badge text="Stable"/>
......@@ -337,59 +333,50 @@ social_setting:
footer:
# 背景图片
bg_image:
# 是否启用
enable: false
# 填写图片路径或链接
url: https://xxxxx.png
# 遮罩效果(目前只有黑色遮罩)
# 遮罩效果
mask:
# 是否启用
enable: false
# 遮罩透明度 (取值: 0 ~ 1).
opacity: 0.5
# 版权信息
copyright:
# 是否启用
enable: true
# 显示的文字信息,例如:xxx All Rights Reserved.
# 如果不设置,将显示 hexo 配置文件中的 author 属性的内容
# 显示的文字信息,例如:xxx All Rights Reserved
# 如果不设置,将显示 Hexo 配置文件中 author 项的内容
text:
# 开始时间(如果不设置,将显示最新的年份)
# 开始时间(如果不设置,将使用最新的年份)
since:
# 结束时间(如果不设置,将显示最新的年份)
# 结束时间(如果不设置,将使用最新的年份)
end:
# 时间和文字信息之间的图标
# 日期和版权之间的图标
icon:
# 是否启用
enable: true
# 建议使用名为 `heart` 的图标
# 图标名称在这里查找:https://fontawesome.com/v4.7.0/icons/
name: heart
# 查找图标名称,请访问:https://fontawesome.com/icons
name: fas fa-heart
# 心跳动画
animation: true
# 请使用引号包裹颜色值(支持所有 CSS 颜色单位)
animation: false
# 请使用包裹值(支持所有 CSS 颜色单位)
color: "#ff0000"
# Hexo 链接(Powered by Hexo)
powered:
# 是否启用
enable: true
# 显示版本号(例如:vX.X.X)
version: true
# 主题链接(Theme - stun)
# 主题链接(Theme - Stun)
theme:
# 是否启用
enable: true
# 显示版本号(例如:vX.X.X)
version: true
# 备案信息(只有中国开发者会用到)详情: http://www.miitbeian.gov.cn/
beian:
# 是否启用
enable: false
# 备案 XXXXXXXX 号
icp:
# 任何自定义文本,支持 HTML(例如:托管于 <a href="https://pages.github.com/" rel="noopener" target="_blank">Github Pages</a>
custom:
# 是否启用
enable: false
# 自定义文本内容
text:
......@@ -405,38 +392,28 @@ footer:
``` yaml
back2top:
# 是否启用
enable: true
# 显示的图标
icon:
# 建议使用名为 `rocket` 的图标
# 图标名称在这里查找:https://fontawesome.com/v4.7.0/icons/
name: rocket
# 查找图标名称,请访问:https://fontawesome.com/icons
name: fas fa-rocket
# 火箭发射动画
animation: true
# 图标的旋转角度(角度的单位是:deg)
rotate: -45deg
# 请使用引号包裹颜色值(支持所有 CSS 颜色单位)
# 请使用引号包裹值(支持所有 CSS 颜色单位)
color: "#49b1f5"
hover_color: "#fc6423"
```
## 文章摘要 <Badge text="Stable"/>
如果想要保留文章摘要,需要**手动**在文章的 Markdown 源文件中添加 `<!-- more -->` 标记。标记之前的部分都会被保留为文章摘要,显示在文章列表中。
如果想要自动保留文章摘要,可以通过修改主题配置文件:
如果想要保留文章摘要,你需要在文章的 Markdown 源文件中添加 `<!-- more -->` 标记。标记之前的部分都会被保留为文章摘要,显示在文章列表中。
``` yaml
auto_excerpt:
# 是否启用
enable: false
# 自动保留的字数
length: 150
```
> 由于自动保留摘要的效果并不理想,所以这里不建议开启。
::: danger
从 `v1.8.0` 版本开始,主题不再提供自动保留摘要的功能。
:::
---
到这里就完成了最基本的配置,如果你还想更详细的配置主题,请向后继续阅读文档。
到这里就完成了最基本的配置,如果你还想更详细的配置主题,请继续向后阅读文档。
......@@ -2,17 +2,17 @@
## 安装
- 安装 stun
- 安装 Stun
进入 hexo 根目录,执行指令。
在 Hexo 根目录下,执行指令:
``` bash
$ git clone https://github.com/liuyib/hexo-theme-stun.git themes/stun
```
- 安装依赖 pug
- 安装依赖 `hexo-render-pug`
进入 hexo 根目录,执行指令。
在 Hexo 根目录下,执行指令:
``` bash
$ npm install --save hexo-render-pug
......@@ -20,13 +20,13 @@
## 使用
修改 hexo 根目录下的 `_config.yml` 文件。
修改 Hexo 根目录下的 `_config.yml` 文件:
``` yml
theme: stun
```
然后,启动 hexo 服务器。
启动 Hexo 服务器:
``` bash
$ hexo clean && hexo s
......@@ -34,12 +34,14 @@ $ hexo clean && hexo s
## 更新
在 Hexo 根目录下,执行指令:
``` bash
$ cd themes/stun
# 更新到稳定版本(推荐)
$ git pull origin master
# 更新到最新功能(可能不稳定,不推荐)
# 更新到最新功能(不推荐)
$ git pull origin dev
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册