AnZhiYu主题安装文档(三)

本教程更新于 2023 年 4 月 24 日,教程的内容针对最新的 anzhiyu 主题(如果你是旧版本,教程会有出入,请留意)
🐟 安知鱼 已经更新到 1.1.8
Footer 设置
since
是一个来展示你站点起始时间的选项。它位于页面的最底部。
1 | # Footer Settings |
参数 | 解释 |
---|---|
owner | 页脚网站所有者@2020-当前年份 |
owner.enable | 页脚网站所有者是否启用 |
owner.since | 页脚年份,控制台中打印的运行时间也来自这里 |
runtime | 运行时间 |
runtime.enable | 运行时间是否启用 |
runtime.launch_time | 网站上线时间 |
runtime.work_img | 页脚上班时间的徽标 |
runtime.work_description | 页脚上班时间的 title 描述 |
runtime.offduty_img | 页脚下班时间的徽标 |
runtime.offduty_description | 页脚下班时间的 title 描述 |
bdageitem | 徽标配置项 |
bdageitem.link | 徽标配置链接 |
bdageitem.shields | 徽标配置徽标 |
bdageitem.message | 徽标配置徽标 title |
侧边栏设置 (aside)
可自行决定哪个项目需要显示,可决定位置,也可以设置不显示侧边栏。
修改 主题配置文件
1 | # aside (侧边栏) |
访问人数 busuanzi (UV 和 PV)
访问 busuanzi 的官方网站查看更多的介绍。
修改 主题配置文件
1 | busuanzi: |
如果需要修改 busuanzi 的 CDN 链接,可通过 主题配置文件 的 CDN 中的 option 进行修改
1 | CDN: |
运行时间
网页已运行时间
修改 主题配置文件
1 | # Time difference between publish date and now (网页运行时间) |
最新评论
最新评论只会在刷新时才会去读取,并不会实时变化
由于 API 有 访问次数限制,为了避免调用太多,主题默认存取期限为 10 分钟。也就是説,调用后资料会存在 localStorage 里,10 分钟内刷新网站只会去 localStorage 读取资料。 10 分钟期限一过,刷新页面时才会去调取 API 读取新的数据。( 3.6.0 新增了 storage 配置,可自行配置缓存时间)
在侧边栏显示最新评论板块
修改 主题配置文件
1 | # Aside widget - Newest Comments |
配置 | 解释 |
---|---|
limit | 显示的数量 |
storage | 设置缓存时间,单位 分钟 |
avatar | 是否显示头像 |
右下角按钮 (Bottom right button)
简繁转换
简体繁体互换
右下角会有简繁转换按钮。
修改 主题配置文件
1 | translate: |
简体
繁体
阅读模式
阅读模式下会去掉除文章外的内容,避免干扰阅读。
只会出现在文章页面,右下角会有阅读模式按钮。
修改 主题配置文件
1 | readmode: true |
夜间模式
右下角会有夜间模式按钮
修改 主题配置文件
1 | # dark mode |
参数 | 解释 |
---|---|
button | 是否在右下角显示日夜模式切换按钮 |
autoChangeMode | 自动切换的模式 |
autoChangeMode | autoChangeMode: 1 跟随系统而变化,不支持的浏览器/系统将按照时间 start 到 end 之间切换为 light mode autoChangeMode: 2 只按照时间 start 到 end 之间切换为 light mode ,其余时间为 dark mode autoChangeMode: false 取消自动切换 |
start | light mode 的开始时间 |
end | light mode 的结束时间 |
按钮排序
1 | # Don't modify the following settings unless you know how they work (非必要请不要修改 ) |
标签外挂(Tag Plugins)
标签外挂是 Hexo 独有的功能,并不是标准的 Markdown 格式。
以下的写法,只适用于 AnZhiYu 主题,用在其它主题上不会有效果,甚至可能会报错。使用前请留意
标签外挂虽然能为主题带来一些额外的功能和 UI 方面的强化,但是,标签外挂也有明显的限制,使用时请留意。
Note (Bootstrap Callout)
修改主题配置文件
1 | note: |
Note
标签外挂有两种用法。icons
和light_bg_offset
只对方法一生效。
fontawesome
图标需开启主题配置文件中icons.fontawesome
方法一
1 | {% note [class] [no-icon] [style] %} |
方法二
1 | {% note [color] [icon] [style] %} |
方法一
参数 | 用法 |
---|---|
class | 【可选】标识,不同的标识有不同的配色 ( default / primary / success / info / warning / danger ) |
no-icon | 【可选】不显示 icon |
style | 【可选】可以覆盖配置中的 style (simple/modern/flat/disabled) |
方法二
参数 | 用法 |
---|---|
class | 【可选】标识,不同的标识有不同的配色 ( default / blue / pink / red / purple / orange / green ) |
no-icon | 【可选】可配置自定义 icon (支持 fontawesome 图标和主题内置的阿里图标,fontawesome 图标需开启主题配置文件中icons.fontawesome , 也可以配置 no-icon ) |
style | 【可选】可以覆盖配置中的 style (simple/modern/flat/disabled) |
方法一
simple
样式默认 提示块标签
default 提示块标签
primary 提示块标签
success 提示块标签
info 提示块标签
warning 提示块标签
danger 提示块标签
modern
样式默认 提示块标签
default 提示块标签
primary 提示块标签
success 提示块标签
info 提示块标签
warning 提示块标签
danger 提示块标签
flat
样式默认 提示块标签
default 提示块标签
primary 提示块标签
success 提示块标签
info 提示块标签
warning 提示块标签
danger 提示块标签
disabled
样式默认 提示块标签
default 提示块标签
primary 提示块标签
success 提示块标签
info 提示块标签
warning 提示块标签
danger 提示块标签
no-icon
样式
方法二
图标支持 fontawesome
和 主题内置的阿里图标
,使用方法为加上对应的类名,fontawesome
图标需开启主题配置文件中icons.fontawesome
,默认未开启 fontawesome
simple 样式
主题内置阿里图标
fontawesome 图标
,开启主题配置文件中的icons.fontawesome
为true
后可见你是刷 Visa 还是 UnionPay
2022 年快到了….
小心开车 安全至上
这是三片呢?还是四片?
你是刷 Visa 还是 UnionPay
剪刀石头布
前端最讨厌的浏览器
modern 样式
主题内置阿里图标
fontawesome 图标
,开启主题配置文件中的icons.fontawesome
为true
后可见你是刷 Visa 还是 UnionPay
2021 年快到了….
小心开车 安全至上
这是三片呢?还是四片?
你是刷 Visa 还是 UnionPay
剪刀石头布
前端最讨厌的浏览器
flat 样式
主题内置阿里图标
fontawesome 图标
,开启主题配置文件中的icons.fontawesome
为true
后可见你是刷 Visa 还是 UnionPay
2021 年快到了….
小心开车 安全至上
这是三片呢?还是四片?
你是刷 Visa 还是 UnionPay
剪刀石头布
前端最讨厌的浏览器
disabled 样式
主题内置阿里图标
fontawesome 图标
,开启主题配置文件中的icons.fontawesome
为true
后可见你是刷 Visa 还是 UnionPay
2021 年快到了….
小心开车 安全至上
这是三片呢?还是四片?
你是刷 Visa 还是 UnionPay
剪刀石头布
前端最讨厌的浏览器
no-icon 样式
方法一
simple
样式1
2
3
4
5
6
7{% note simple %}默认 提示块标签{% endnote %}
{% note default simple %}default 提示块标签{% endnote %}
{% note primary simple %}primary 提示块标签{% endnote %}
{% note success simple %}success 提示块标签{% endnote %}
{% note info simple %}info 提示块标签{% endnote %}
{% note warning simple %}warning 提示块标签{% endnote %}
{% note danger simple %}danger 提示块标签{% endnote %}modern
样式1
2
3
4
5
6
7{% note modern %}默认 提示块标签{% endnote %}
{% note default modern %}default 提示块标签{% endnote %}
{% note primary modern %}primary 提示块标签{% endnote %}
{% note success modern %}success 提示块标签{% endnote %}
{% note info modern %}info 提示块标签{% endnote %}
{% note warning modern %}warning 提示块标签{% endnote %}
{% note danger modern %}danger 提示块标签{% endnote %}flat
样式1
2
3
4
5
6
7{% note flat %}默认 提示块标签{% endnote %}
{% note default flat %}default 提示块标签{% endnote %}
{% note primary flat %}primary 提示块标签{% endnote %}
{% note success flat %}success 提示块标签{% endnote %}
{% note info flat %}info 提示块标签{% endnote %}
{% note warning flat %}warning 提示块标签{% endnote %}
{% note danger flat %}danger 提示块标签{% endnote %}disabled
样式1
2
3
4
5
6
7{% note disabled %}默认 提示块标签{% endnote %}
{% note default disabled %}default 提示块标签{% endnote %}
{% note primary disabled %}primary 提示块标签{% endnote %}
{% note success disabled %}success 提示块标签{% endnote %}
{% note info disabled %}info 提示块标签{% endnote %}
{% note warning disabled %}warning 提示块标签{% endnote %}
{% note danger disabled %}danger 提示块标签{% endnote %}no-icon
样式1
2
3
4
5
6
7{% note no-icon %}默认 提示块标签{% endnote %}
{% note default no-icon %}default 提示块标签{% endnote %}
{% note primary no-icon %}primary 提示块标签{% endnote %}
{% note success no-icon %}success 提示块标签{% endnote %}
{% note info no-icon %}info 提示块标签{% endnote %}
{% note warning no-icon %}warning 提示块标签{% endnote %}
{% note danger no-icon %}danger 提示块标签{% endnote %}
方法二
图标支持 fontawesome
和 主题内置的阿里图标
,使用方法为加上对应的类名,fontawesome
图标需开启主题配置文件中icons.fontawesome
,默认未开启 fontawesome
simple 样式
主题内置阿里图标
1
2
3
4
5
6
7{% note 'anzhiyufont anzhiyu-icon-rocket' simple %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note blue 'anzhiyufont anzhiyu-icon-bullhorn' simple %}2022 年快到了....{% endnote %}
{% note pink 'anzhiyufont anzhiyu-icon-instagram' simple %}小心开车 安全至上{% endnote %}
{% note red 'anzhiyufont anzhiyu-icon-fan' simple%}这是三片呢?还是四片?{% endnote %}
{% note orange 'anzhiyufont anzhiyu-icon-dengpao' simple %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note purple 'anzhiyufont anzhiyu-icon-sanmingzhi' simple %}剪刀石头布{% endnote %}
{% note green 'anzhiyufont anzhiyu-icon-ic_train' simple %}前端最讨厌的浏览器{% endnote %}fontawesome 图标
,开启主题配置文件中的icons.fontawesome
为true
后可见1
2
3
4
5
6
7{% note 'fab fa-cc-visa' simple %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note blue 'fas fa-bullhorn' simple %}2022 年快到了....{% endnote %}
{% note pink 'fas fa-car-crash' simple %}小心开车 安全至上{% endnote %}
{% note red 'icon-fan' simple%}这是三片呢?还是四片?{% endnote %}
{% note orange 'fas fa-battery-half' simple %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note purple 'far fa-hand-scissors' simple %}剪刀石头布{% endnote %}
{% note green 'fab fa-internet-explorer' simple %}前端最讨厌的浏览器{% endnote %}modern 样式
主题内置阿里图标
1
2
3
4
5
6
7{% note 'anzhiyufont anzhiyu-icon-rocket' modern %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note blue 'anzhiyufont anzhiyu-icon-bullhorn' modern %}2022 年快到了....{% endnote %}
{% note pink 'anzhiyufont anzhiyu-icon-instagram' modern %}小心开车 安全至上{% endnote %}
{% note red 'anzhiyufont anzhiyu-icon-fan' modern%}这是三片呢?还是四片?{% endnote %}
{% note orange 'anzhiyufont anzhiyu-icon-dengpao' modern %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note purple 'anzhiyufont anzhiyu-icon-sanmingzhi' modern %}剪刀石头布{% endnote %}
{% note green 'anzhiyufont anzhiyu-icon-ic_train' modern %}前端最讨厌的浏览器{% endnote %}fontawesome 图标
,开启主题配置文件中的icons.fontawesome
为true
后可见1
2
3
4
5
6
7{% note 'fab fa-cc-visa' modern %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note blue 'fas fa-bullhorn' modern %}2021 年快到了....{% endnote %}
{% note pink 'fas fa-car-crash' modern %}小心开车 安全至上{% endnote %}
{% note red 'icon-fan' modern%}这是三片呢?还是四片?{% endnote %}
{% note orange 'fas fa-battery-half' modern %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note purple 'far fa-hand-scissors' modern %}剪刀石头布{% endnote %}
{% note green 'fab fa-internet-explorer' modern %}前端最讨厌的浏览器{% endnote %}flat 样式
主题内置阿里图标
1
2
3
4
5
6
7{% note 'anzhiyufont anzhiyu-icon-rocket' flat %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note blue 'anzhiyufont anzhiyu-icon-bullhorn' flat %}2022 年快到了....{% endnote %}
{% note pink 'anzhiyufont anzhiyu-icon-instagram' flat %}小心开车 安全至上{% endnote %}
{% note red 'anzhiyufont anzhiyu-icon-fan' flat%}这是三片呢?还是四片?{% endnote %}
{% note orange 'anzhiyufont anzhiyu-icon-dengpao' flat %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note purple 'anzhiyufont anzhiyu-icon-sanmingzhi' flat %}剪刀石头布{% endnote %}
{% note green 'anzhiyufont anzhiyu-icon-ic_train' flat %}前端最讨厌的浏览器{% endnote %}1
2
3
4
5
6
7
8<p><code>fontawesome 图标</code>,开启主题配置文件中的<code>icons.fontawesome</code>为<code>true</code>后可见</p>
{% note 'fab fa-cc-visa' flat %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note blue 'fas fa-bullhorn' flat %}2021 年快到了....{% endnote %}
{% note pink 'fas fa-car-crash' flat %}小心开车 安全至上{% endnote %}
{% note red 'icon-fan' flat%}这是三片呢?还是四片?{% endnote %}
{% note orange 'fas fa-battery-half' flat %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note purple 'far fa-hand-scissors' flat %}剪刀石头布{% endnote %}
{% note green 'fab fa-internet-explorer' flat %}前端最讨厌的浏览器{% endnote %}disabled 样式
主题内置阿里图标
1
2
3
4
5
6
7{% note 'anzhiyufont anzhiyu-icon-rocket' disabled %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note blue 'anzhiyufont anzhiyu-icon-bullhorn' disabled %}2022 年快到了....{% endnote %}
{% note pink 'anzhiyufont anzhiyu-icon-instagram' disabled %}小心开车 安全至上{% endnote %}
{% note red 'anzhiyufont anzhiyu-icon-fan' disabled%}这是三片呢?还是四片?{% endnote %}
{% note orange 'anzhiyufont anzhiyu-icon-dengpao' disabled %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note purple 'anzhiyufont anzhiyu-icon-sanmingzhi' disabled %}剪刀石头布{% endnote %}
{% note green 'anzhiyufont anzhiyu-icon-ic_train' disabled %}前端最讨厌的浏览器{% endnote %}fontawesome 图标
,开启主题配置文件中的icons.fontawesome
为true
后可见1
2
3
4
5
6
7{% note 'fab fa-cc-visa' disabled %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note blue 'fas fa-bullhorn' disabled %}2021 年快到了....{% endnote %}
{% note pink 'fas fa-car-crash' disabled %}小心开车 安全至上{% endnote %}
{% note red 'icon-fan' disabled %}这是三片呢?还是四片?{% endnote %}
{% note orange 'fas fa-battery-half' disabled %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note purple 'far fa-hand-scissors' disabled %}剪刀石头布{% endnote %}
{% note green 'fab fa-internet-explorer' disabled %}前端最讨厌的浏览器{% endnote %}no-icon 样式
1
2
3
4
5
6
7{% note no-icon %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note blue no-icon %}2021 年快到了....{% endnote %}
{% note pink no-icon %}小心开车 安全至上{% endnote %}
{% note red no-icon %}这是三片呢?还是四片?{% endnote %}
{% note orange no-icon %}你是刷 Visa 还是 UnionPay{% endnote %}
{% note purple no-icon %}剪刀石头布{% endnote %}
{% note green no-icon %}前端最讨厌的浏览器{% endnote %}
Gallery 相册图库
一个图库集合。
gallerygroup 相册图库
1
2
3
4
5<div class="gallery-group-main">
{% galleryGroup name description link img-url %}
{% galleryGroup name description link img-url %}
{% galleryGroup name description link img-url %}
</div>gallery 相册
1 | {% gallery %} |
参数名 | 释义 |
---|---|
lazyload | 【可选】点击按钮加载更多图片,填写 true/false。默认为 false 。 |
rowHeight | 【可选】图片显示的高度,如果需要一行显示更多的图片,可设置更小的数字。默认为 220 。 |
limit | 【可选】每次加载多少张照片。默认为 10 。 |
1 | {% gallery url,[link],[lazyload],[rowHeight],[limit] %} |
参数名 | 释义 |
---|---|
url | 【必须】 识别词 |
link | 【必须】远程的 json 链接 |
lazyload | 【可选】点击按钮加载更多图片,填写 true/false。默认为 false 。 |
rowHeight | 【可选】图片显示的高度,如果需要一行显示更多的图片,可设置更小的数字。默认为 220 。 |
limit | 【可选】每次加载多少张照片。默认为 10 。 |
远程链接 Json 的例子
有三个参数,url
是必须存在的,alt
和 title
可有,也可没有。
1 | [ |
示例
1 | {% gallery url,https://xxxx.com/sss.json %} |
gallerygroup 相册图库
| 参数名 | 释义 |
| :————— | :—————————- |
| name | 图库名字 |
| description | 图库描述 |
| link | 链接到对应相册的地址 |
| img-url | 图库封面 |
</li>
</ul>思维拓展一下,相册图库的实质其实就是个快捷方式,可以自定义添加描述、封面、链接。那么我们未必要把它当做一个相册,完全可以作为一个链接卡片,链接到视频、QQ、友链都是不错的选择。
- gallery 相册
区别于旧版的 Gallery 相册,新的 Gallery 相册会自动根据图片长度进行排版,书写也更加方便,与 markdown 格式一样。可根据需要插入到相应的 md。无需再自己配置长宽。建议在粘贴时故意使用长短、大小、横竖不一的图片,会有更好的效果。(尺寸完全相同的图片只会平铺输出,效果很糟糕)
1
2
3
4
5
6
7
8
9
10
11{% gallery %}
markdown 图片格式
{% endgallery %}
{% gallery true,220,10 %}
markdown 图片格式
{% endgallery %}
{% gallery true,,10 %}
markdown 图片格式
{% endgallery %}参数名 释义 lazyload 【可选】点击按钮加载更多图片,填写 true/false。默认为 false
。rowHeight 【可选】图片显示的高度,如果需要一行显示更多的图片,可设置更小的数字。默认为 220
。limit 【可选】每次加载多少张照片。默认为 10
。1
2{% gallery url,[link],[lazyload],[rowHeight],[limit] %}
{% endgallery %}参数名 释义 url 【必须】 识别词 link 【必须】远程的 json 链接 lazyload 【可选】点击按钮加载更多图片,填写 true/false。默认为 false
。rowHeight 【可选】图片显示的高度,如果需要一行显示更多的图片,可设置更小的数字。默认为 220
。limit 【可选】每次加载多少张照片。默认为 10
。远程链接 Json 的例子
有三个参数,
url
是必须存在的,alt
和title
可有,也可没有。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19[
{
"url": "https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/IMG_0556.jpg",
"alt": "IMG_0556.jpg",
"title": "这是title"
},
{
"url": "https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/IMG_0472.jpg",
"alt": "IMG_0472.jpg"
},
{
"url": "https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/IMG_0453.jpg",
"alt": ""
},
{
"url": "https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/IMG_0931.jpg",
"alt": ""
}
]示例
1
2
3
4
5
6
7
8{% gallery url,https://xxxx.com/sss.json %}
{% endgallery %}
{% gallery url,https://xxxx.com/sss.json,true,220,10 %}
{% endgallery %}
{% gallery url,https://xxxx.com/sss.json,true,,10 %}
{% endgallery %}- gallery 相册
- gallerygroup 相册图库
- gallery 相册
</ul>
</ul>
对于很多同学提问的gallerygroup
和gallery
相册页的链接问题。这里说下我个人的使用习惯。
一般使用相册图库的话,可以在导航栏加一个 gallery 的 page(使用指令hexo new page gallery
添加),里面放相册图库作为封面。然后在[Blogroot]/source/gallery/
下面建立相应的文件夹,例如若按照这里的示例,若欲使用/gallery/MC/
路径访问 MC 相册,则需要新建[Blogroot]/source/gallery/MC/index.md
,并在里面填入gallery
相册内容。
注意 ⚠️:本站相册集为单独优化,可参考配置相册页面。
</div>
gallerygroup 相册图库
1
2
3
4
5<div class="gallery-group-main">
{% galleryGroup MC 在Rikkaの六花服务器里留下的足迹 '/gallery/MC/' https://cdn.cbd.int/akilar-candyassets@1.0.36/image/1.jpg %}
{% galleryGroup Gundam 哦咧哇gundam哒! '/gallery/Gundam/' https://cdn.cbd.int/akilar-candyassets@1.0.36/image/20200907110508327.png %}
{% galleryGroup I-am-Akilar 某种意义上也算自拍吧 '/gallery/I-am-Akilar/' https://cdn.cbd.int/akilar-candyassets@1.0.36/image/20200907113116651.png %}
</div>gallery 相册
1
2
3
4
5
6
7
8
9
10{% gallery true,,2 %}








{% endgallery %}