image frame

博客

知足常乐

65.压缩VHD文件

目前仅测试过vhd没有测试过vhdx,但理论上来说应该通用

1
(echo select vdisk file="vhd绝对路径" & echo detach vdisk & echo attach vdisk readonly & echo compact vdisk & echo detach vdisk)|diskpart

参考出处:点击此处

63.将Hexo推送至Github Pages

hexo-deployer-git的GitHub项目页:点击此处

1.安装hexo-deployer-git插件

1
npm install hexo-deployer-git --save

2.修改blog文件夹下的_config.yml
修改前:

1
2
3
4
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: ''

修改后:

1
2
3
4
5
6
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo: https://github.com/kukusun/kukusun.github.io.git
branch: master

3.推送至Github Pages
在自己的GitHub帐号中创建一个repository,名称为:用户名.github.io
设置git的邮箱与名称,以前设置过就无需再次设置

1
2
git config --global user.email "you@example.com"
git config --global user.name "Your Name"

用命令推送:

1
hexo d

此时可能需要设置GitHub帐号的登陆,可以直接登录,也可以用token方式推送Blog
如果选择用token方式则点击此处跳转token管理界面
token创建步骤

  • 右上角Generate new token处选择Generate new token (classic)
  • Note写入自定义的名称
  • Expiration设置过期时间
  • Select scopes中将repo栏中的选项全部勾选

62.为Hexo文章生成永久固定链接

hexo-abbrlink的GitHub项目页:点击此处

1.安装hexo-abbrlink插件

1
npm install hexo-abbrlink --save

2.修改blog文件夹下的_config.yml
修改前:

1
2
3
4
5
6
7
8
# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: http://example.com
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks

修改后:

1
2
3
4
5
6
7
8
9
10
11
12
# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: http://example.com
#permalink: :year/:month/:day/:title/
permalink: posts/:abbrlink.html
abbrlink:
alg: crc32 #算法: crc16(default) and crc32
rep: hex #进制: dec(default) and hex
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks

3.修改blog –> node_modules –> hexo-asset-image文件夹下的index.js
修改前:

1
2
3
4
5
6
7
8
9
if(/.*\/index\.html$/.test(link)) {
// when permalink is end with index.html, for example 2019/02/20/xxtitle/index.html
// image in xxtitle/ will go to xxtitle/index/
appendLink = 'index/';
var endPos = link.lastIndexOf('/');
}
else {
var endPos = link.length-1;
}

修改后:

1
2
3
4
5
6
7
8
9
if(/.*\/index\.html$/.test(link)) {
// when permalink is end with index.html, for example 2019/02/20/xxtitle/index.html
// image in xxtitle/ will go to xxtitle/index/
appendLink = 'index/';
var endPos = link.lastIndexOf('/');
}
else {
var endPos = link.length-5;
}

参考出处:点击此处

61.为Hexo启用文章加密

hexo-blog-encrypt的GitHub项目页:点击此处

1.安装hexo-blog-encrypt插件

1
npm install hexo-blog-encrypt --save

2.修改配置文件
修改blog文件夹下的_config.yml,追加以下内容:

1
2
3
4
5
# hexo-blog-encrypt
encrypt:
abstract: 该文章已加密,请输入密码后查看
message: 请在此处输入密码
wrong_pass_message: 密码不太对哦,请重新输入!

abstract为主页显示的加密提示语
message为密码输入框的提示语
wrong_pass_message密码输入错误的提示语
3.修改blog –> node_modules –> hexo-blog-encrypt –> lib文件夹下的hbe.js(非必要步骤)
修改前

1
2
3
4
const hideButton = document.createElement('button');
hideButton.textContent = 'Encrypt again';
hideButton.type = 'button';
hideButton.classList.add("hbe-button");

修改后

1
2
3
4
const hideButton = document.createElement('button');
hideButton.textContent = '重新进行加密';
hideButton.type = 'button';
hideButton.classList.add("hbe-button");

4.在需要加密的文章头部添加password选项

60.为Hexo启用文章搜索功能

hexo-generator-search的GitHub项目页:点击此处

1.为hexo添加hexo-generator-search插件

1
npm install hexo-generator-search --save

2.修改配置文件
对blog文件夹下的_config.yml添加以下内容

1
2
3
4
# hexo-generator-search
search:
path: search.xml
field: post
  • Copyrights © 2023-2025 kukusun