124 lines
2.6 KiB
Markdown
124 lines
2.6 KiB
Markdown
---
|
||
title: Hexo
|
||
date: 2022-11-18 10:30:31
|
||
author: 文永达
|
||
---
|
||
|
||
# Hexo
|
||
|
||
启动本地开发服务器
|
||
|
||
```shell
|
||
hexo server
|
||
# or
|
||
hexo s
|
||
```
|
||
|
||
清空本地缓存
|
||
|
||
```shell
|
||
hexo clean
|
||
```
|
||
|
||
构建并发布到Git上
|
||
|
||
```shell
|
||
hexo g -d
|
||
```
|
||
|
||
只构建
|
||
|
||
```shell
|
||
hexo g
|
||
```
|
||
|
||
将安装的主题推送到Git上
|
||
|
||
因为主题也是一个git项目,需要先把`.git`剪切到任意位置
|
||
|
||
`.git`文件夹在 `themes/butterfly`目录下,是一个隐藏文件夹
|
||
|
||
```shell
|
||
git rm --cache themes/butterfly
|
||
git status
|
||
git add themes/butterfly
|
||
```
|
||
|
||
新建文章
|
||
|
||
```shell
|
||
hexo new [layout] <title>
|
||
```
|
||
|
||
新建一篇文章。如果没有设置 `layout` 的话,默认使用 [_config.yml](https://hexo.io/zh-cn/docs/configuration) 中的 `default_layout` 参数代替。如果标题包含空格的话,请使用引号括起来。
|
||
|
||
# Butterfly 主题
|
||
|
||
## 鼠标样式修改
|
||
|
||
1. 在\themes\butterfly\source\css路径下创建一个mouse.css文件,在文件中添加如下代码:
|
||
```css
|
||
body {
|
||
cursor: url(https://cdn.jsdelivr.net/gh/sviptzk/HexoStaticFile@latest/Hexo/img/default.cur),
|
||
default;
|
||
}
|
||
a,
|
||
img {
|
||
cursor: url(https://cdn.jsdelivr.net/gh/sviptzk/HexoStaticFile@latest/Hexo/img/pointer.cur),
|
||
default;
|
||
}
|
||
```
|
||
|
||
|
||
|
||
2. 打开站点的主题配置文件_config.butterfly.yml,找到inject,在head处直接引入该文件:
|
||
```yaml
|
||
inject:
|
||
head:
|
||
- <link rel="stylesheet" href="/css/mouse.css">
|
||
```
|
||
|
||
|
||
|
||
3. 重新部署,即可看到效果
|
||
|
||
## 增加网站备案信息
|
||
|
||
找到`themes/butterfly/layout/includes/footer.pug`文件
|
||
|
||
在文件 `if theme.footer.copyright`中增加
|
||
|
||
```pug
|
||
br
|
||
center
|
||
| ICP备案号:
|
||
a(href="https://beian.miit.gov.cn" target="_blank") 辽ICP备2025052969号-1
|
||
```
|
||
|
||
完整如下:
|
||
|
||
```pug
|
||
#footer-wrap
|
||
if theme.footer.owner.enable
|
||
- var now = new Date()
|
||
- var nowYear = now.getFullYear()
|
||
if theme.footer.owner.since && theme.footer.owner.since != nowYear
|
||
.copyright!= `©${theme.footer.owner.since} - ${nowYear} By ${config.author}`
|
||
else
|
||
.copyright!= `©${nowYear} By ${config.author}`
|
||
if theme.footer.copyright
|
||
.framework-info
|
||
span= _p('footer.framework') + ' '
|
||
a(href='https://hexo.io')= 'Hexo'
|
||
span.footer-separator |
|
||
span= _p('footer.theme') + ' '
|
||
a(href='https://github.com/jerryc127/hexo-theme-butterfly')= 'Butterfly'
|
||
br
|
||
center
|
||
| ICP备案号:
|
||
a(href="https://beian.miit.gov.cn" target="_blank") 辽ICP备2025052969号-1
|
||
if theme.footer.custom_text
|
||
.footer_custom_text!=`${theme.footer.custom_text}`
|
||
```
|
||
|