Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

环境准备

  • Node.js环境
  • Git

Hexo安装

1
npm install hexo -g

升级

更新hexo最新版本

1
npm update hexo -g

博客搭建

Github上创建一个仓库my-blog,并clone到本地

  1. 初始化

    1
    2
    cd my-blog
    hexo init
  1. 生成网站

    1
    hexo g
  1. 启动本地

    1
    hexo s

    启动服务后,就可以访问:http://localhost:4000/(port 预设为 4000,可在 _config.yml 设定)

部署步骤

每次部署的步骤,可按以下三步来进行:

1
2
3
hexo clean
hexo generate
hexo deploy

常用命令

1
2
3
4
5
6
7
hexo new "postName" #新建文章
hexo new page "pageName" #新建页面
hexo generate #生成静态页面至public目录
hexo server #开启预览访问端口(默认端口4000,'ctrl + c'关闭server)
hexo deploy #将.deploy目录部署到GitHub
hexo help # 查看帮助
hexo version #查看Hexo的版本