0%

hexo博客工具

一、新建文章

一般操作:

  • 使用 hexo new $$ name ,创建博客
  • 然后再进入到文章文件夹内,打开 markdown 文件

使用批处理操作优化后,双击 write.bat ,输入名字,回车即可

1
2
3
4
5
6
7
@echo off
chcp 65001
set /p a=请输入blog名字:
cd {F:\文档\myblog\source\_posts\}
{F:}
hexo new %a% && start {G:\Typora\Typora.exe} %a%.md
exit

注意使用的时候,需要把 {} 内的参照上面的换成自己本地的路径,并把 {} 也去掉

前面的方法最近发现了点问题,当输入的博客名带点、空格等特殊字符时会出现问题,所以改用 python 脚本实现

1
2
3
4
5
6
7
8
import os
file = input("请输入blog名字:")
file2 = file.replace(' ', '-')
file2 = file2.replace('.', '-')
hexo = 'hexo new "' + file2 + '"'
filePath = 'F:\\文档\\myblog\\source\\_posts\\'
typora = '&& start G:\Typora\Typora.exe ' + filePath + file2 + '.md'
os.system(hexo + typora)

二、本地预览

1
hexo clean && hexo g && hexo s

三、推送部署

1
hexo clean && hexo g && hexo d

四、其他

编写好 bat 文件后,可以创建快捷方式到桌面,然后右键-属性-更改图标,选择一个自己喜欢的系统图标,也可以选择浏览选择自己创建的一个图标文件

image-20210411000712972