优化主题anzhiyu

优化主题anzhiyu
Otherisland总结
- 主题安装
内容来源:主题安装 | 安知鱼主题官方文档
方式一方式二1
git clone -b main https://github.com/anzhiyu-c/hexo-theme-anzhiyu.git themes/anzhiyu
下载 最新 release 版本 解压到themes
目录,并将解压出的文件夹重命名为anzhiyu
。 - 安装
pug
和stylus
渲染插件1
npm install hexo-renderer-pug hexo-renderer-stylus --save
- 本地启动
Hexo
1
2
3
4
5hexo cl # hexo clean
hexo g # hexo generate
hexo s # hexo server
###
hexo d # hexo deploy 部署到github上 - 升级方法
适用于通过 Github 或 Release 压缩包主题,且没有自行修改任何代码的情况。
(1) 先将原文件夹重命名为别的名称,例如 anzhiyu-bkp
,用于升级失败进行回退;
(2) 选择自己的安装方式升级
(3)Github
:重新重新执行安装命令即可Release
:按照安装步骤,下载 release 并解压重命名为 anzhiyu
;
(4) 比对升级后的配置文件_config.yml
,如果某些配置发生了变化(改名或弃用),release 的说明里会特别提示或给出配置文件版本对比diff,同步修改原配置文件即可。
ps: 其他的升级方式没写
front-matter的认识
因为本地要使用obsidian
,所以会在obsidian
的笔记中配置front-matter,类似于:1
2
3
4
5
6
7
8
9
10
11title:
date:
updated:
type:
tags:
categories:
keywords:
description:
top_img:
cover:
comments: "true"标签页配置
找到D:\Blog
,右键Blog
文件夹,选择Open Git Bash here
,输入1
hexo new page tags
找到
D:\Blog\source\tags\index.md
这个文件,修改文件,添加type: "tags"
,例如:1
2
3
4
5
6
7---
title: 标签
date: 2021-04-06 12:01:51
type: "tags"
comments: false
top_img: false
---分类页配置
找到D:\Blog
,右键Blog
文件夹,选择Open Git Bash here
,输入1
hexo new page categories
找到
D:\Blog\source\categories\index.md
这个文件,修改文件,添加type: "categories"
,例如:1
2
3
4
5
6
7---
title: 分类
date: 2021-04-06 12:01:51
aside: false
type: "categories"
top_img: false
---404页面
打开D:\Blog\themes\anzhiyu\_config.yml
,搜索error_404
,将enable
置为true
1
2
3
4
5# A simple 404 page
error_404:
enable: true
subtitle: "页面没有找到"
background:修改站点配置文件
D:\Blog\_config.yml
,默认语言是 en,改成language: zh-CN
修改网站各种资料,例如标题、副标题和邮箱等个人资料,请修改博客根目录的
D:\Blog\_config.yml
。1
2
3
4
5
6
7
8
9
10
11
12title: Otherisland
subtitle: '###'
description: '###'
keywords:
author: Otherisland
language: zh-CN
timezone: 'Asia/Shanghai'
deploy:
type: git
repository: git@github.com:###/###.github.io.git #你的仓库地址
branch: main导航配置,修改
D:\Blog\themes\anzhiyu\_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21menu:
文章:
隧道: /archives/ || anzhiyu-icon-box-archive
分类: /categories/ || anzhiyu-icon-shapes
标签: /tags/ || anzhiyu-icon-tags
友链:
友人帐: /link/ || anzhiyu-icon-link
朋友圈: /fcircle/ || anzhiyu-icon-artstation
留言板: /comments/ || anzhiyu-icon-envelope
我的:
音乐馆: /music/ || anzhiyu-icon-music
追番页: /bangumis/ || anzhiyu-icon-bilibili
相册集: /album/ || anzhiyu-icon-images
小空调: /air-conditioner/ || anzhiyu-icon-fan
关于:
关于本人: /about/ || anzhiyu-icon-paper-plane
闲言碎语: /essay/ || anzhiyu-icon-lightbulb
随便逛逛: javascript:toRandomPost() || anzhiyu-icon-shoe-prints1必须是
/xxx/
,后面||
分开,然后写图标名。导航栏设置(默认的还没改)
代码块配置
代码高亮主题,darker
、pale night
、light
、ocean
、mac
、mac night
,修改主题配置文件D:\Blog\themes\anzhiyu\_config.yml
:1
highlight_theme: mac night
代码复制(默认):
1
highlight_copy: true
代码框展开/关闭(默认):
1
highlight_shrink: true #代码框不展开,需点击 '>' 打开
ps:
true
全部代码框不展开,需要点击>
打开,false
代码块展开,有>
点击按钮,none
不显示>
按钮。
代码换行(默认):1
code_word_wrap: true
代码高度限制(默认):
1
highlight_height_limit: false # unit: px
图标设置(还没配置)
社交图标
书写格式名称:url || icon名称
:1
2
3
4
5
6# social settings (社交图标设置)
# formal:
# name: link || icon
social:
# Github: https://github.com/Otherisland || anzhiyu-icon-github
# BiliBili: https://space.bilibili.com/24506641 || anzhiyu-icon-bilibili(hover动画相关的还没配置)
个人卡片(还没改)
顶部图(现在是给文章
top_img
配置的)文章置顶(还没置顶的)
文章封面(现在是给文章
cover
配置的)文章meta显示(现在是默认的)
文章版权(默认的没改)
文章打赏(默认的没开)
TOC(默认的没改)
相关文章(默认的没改)
文章过期提醒(默认的没开)
文章编辑按钮(默认的没开)
文章分页按钮(默认的没开)
中控台(默认的没改)