配置主题
修改鼠标样式
进入/themes/butterfly/source/css/目录
新建mouse.css文件,写入:
1 | body { |
进入/themes/butterfly/目录
在_config.yml文件中,Inject处的head:项中添加
1 | - <link rel="stylesheet" href="/css/mouse.css"> |
即可。
为Hexo拓展社交图标
以Butterfly主题为例
Hexo Butterfly本身使用Font Awesome库中的图标,但其中不包括中国大陆许多应用,如B站,知乎等等。
使用方法:直接在social: 列表中添加,冒号前为“class“属性值,冒号后为跳转链接,**||**后为。参考案例
1 |
|
因此我们可以使用**阿里iconfont图标**,为我们Butterfly主题拓展一些国内常用的社交图标。
使用方法:
首先进入官网注册,登录;
搜索找到自己需要的图标后(以知乎为例),点击添加到购物车(鼠标放在图标上会有一个购物车图标);
再点击主页右上角的购物车图标,可以看到自己选的图标,然后点击“添加至项目”(没有项目就新建一个);
在主页上方点击“资源管理”进入我的项目中;
点击“下载到本地”;
将下载好的文件发送到/themes/butterfly/source/css/目录下,解压,修改文件夹名为iconfont(压缩包里的文件都放在这个文件夹里);
进入/themes/butterfly/目录下,修改_config.yml文件中的Inject项(使用__config.butterfly.yml配置文件的同学直接修改这个文件就行)
1
2
3
4
5
6
7
8# Inject
# Insert the code to head (before '</head>' tag) and the bottom (before '</body>' tag)
# 插入代码到头部 </head> 之前 和 底部 </body> 之前
inject:
head:
# - <link rel="stylesheet" href="/xxx.css">
bottom:
# - <script src="xxxx"></script>在head:处添加引用我们下载好的文件(注意换行和空格!)
1
- <link rel="stylesheet" href="/css/iconfont/iconfont.css">
可以直接复制下方代码
1
2
3
4
5
6
7
8
9# Inject
# Insert the code to head (before '</head>' tag) and the bottom (before '</body>' tag)
# 插入代码到头部 </head> 之前 和 底部 </body> 之前
inject:
head:
- <link rel="stylesheet" href="/css/iconfont/iconfont.css">
bottom:
# - <script src="xxxx"></script>最后,再修改同一文件中的social settings (社交圖標設置)项
1
2
3
4
5
6
social:
这里我放出我自己的配置
1
2
3
4
5
social:
iconfont icon-zhihu-circle-fill: https://www.zhihu.com/people/ashbell||知乎social:处的iconfont为我们解压文件中的iconfont.css中的文件名,icon-zhihu-circle-fill为我们需要用的知乎的图标名,冒号后面内容前面也提过。
完成上述部分就实现了Hexo Butterfly的图标拓展
有强迫症的同学可能和我一样,发现自己添加的图标不会像主题自带的其它图标一样,当鼠标放在图标上时会有翻转的效果。那么如何能够实现这种翻转呢?
我们只需要修改iconfont.css文件中的.iconfont{}
原内容
1 | .iconfont { |
修改后
1 | .iconfont { |
修改完毕后重载一下Hexo即可。
插件篇
hexo-admonition
Hexo 内容辅助插件,支持将类似 reStructuredText 的警告提示块添加到 Markdown 文档中。例如 note、warning、error 等提示块。
Hexo-admonition 插件使用示例
这是基于 hexo-admonition 插件渲染的一条提示信息。类型为 note,并设置了自定义标题。
提示内容开头留 4 个空格,可以有多行,最后用空行结束此标记。
1 | !!! info 这是一个info示例 |
hexo-auto-excerpt
自动添加
tag
使用方法:
手动加入<!-- more -->
tag。
1 | title: Hexo Butterfly主题美化 |
Hexo-all-minifier
压缩css、js、html和images的插件。
hexo-blog-encrypt
加密文章的插件。
hexo-bilibili-bangumi
hexo 番剧页面插件,可选数据源:Bilibili, Bangumi
hexo-blogroll
展示你最喜欢的几个博客的最新的几篇文章。
1 | npm install hexo-blogroll --save |
使用方法
- 创建
blogroll.json
文件并放入source/_data
目录
1 | { |
- 创建Blogroll页面
1 | --- |
hexo-github-calendar
在博客中插入一个类似GitHub的活动日历。
1 | npm i hexo-githubcalendar --save |
在本目录_config.yml文件中添加(注意不是主题配置文件)
1 | github活动日历 |
hexo-generator-feed
为hexo部署一个信息源页
hexo-algoliasearch
algolias搜索引擎,搭配教程使用。
1 | npm install hexo-algoliasearch --save |
hexo-url-submission
自动提交链接至搜索引擎,用于提高被收录的效率。
hexo-generator-sitemap
生成网站地图
1 | npm install hexo-generator-sitemap --save |
配置_config.yml
1 | sitemap: |
排除页面
1 | --- |
hexo-image-cloudflare
使用Cloudflare去缓存图片
1 | npm i hexo-image-cloudflare |
hexo-steam-games
获取steam游戏库