hexo 命令配置备忘

基本配置

主题文件解压到themes目录下,然后在_config.yml中配置,themename与文件夹名对应

1
2
3
4
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: themename

自动部署需要安装相应网站的插件,例如部署到github

npm install hexo-deployer-git --save

然后修改_config.yml

1
2
3
4
5
6
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repository: https://github.com/xluer/xluer.github.io.git
branch: master

常用命令

hexo clean

清除缓存文件 (db.json) 和已生成的静态文件 (public)。

hexo new [layout] title

新建一篇文章,如果没有设置 layout 的话,默认使用 _config.yml 中的 default_layout 参数代替。如果标题包含空格的话,请使用引号括起来。

hexo generate

生成本地静态文件,缩写:hexo g

hexo deploy

将本地静态文件推送至github 缩写:hexo d

hexo server

启动本地服务,加--drafts可以预览草稿

hexo version

显示 Hexo 版本。

head 参数

  • title 文章的标题
  • date 创建日期 (文件的创建日期 )
  • updated 修改日期 ( 文件的修改日期)
  • comments 是否开启评论 true
  • tags 标签
  • categories 分类
  • permalink url中的名字(文件名)