准备

你需要准备好以下软件:
Node.js环境和Git

Hexo安装

npm install hexo -g

升级

更新hexo到最新版

npm update hexo -g

初始化

hexo init <folder>

如果指定,便会在目前的资料夹建立一个名为的新文件夹;否则会在目前资料夹初始化。

生成网站

hexo g

启动本地服务

hexo s

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

部署步骤

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

hexo clean
hexo generate
hexo deploy

一些常用命令:

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的版本

创建分类页,标签页,友情链接页

分类页

  1. 首先前往你的 Hexo 博客的根目录

  2. 输入hexo new page categories

  3. 打开source/categories/index.md这个文件

  4. 修改这个文件为:

    Yml
    ---
    title: 我的分类页
    date: 2020-07-04 14:55
    type: "categories"
    ---

标签页

  1. 首先前往你的 Hexo 博客的根目录

  2. 输入hexo new page tags

  3. 打开source/tags/index.md这个文件

  4. 修改这个文件为:

    Yml
    ---
    title: 我的标签页
    date: 2020-07-04 14:55
    type: "tags"
    ---

友情链接页

  1. 首先前往你的 Hexo 博客的根目录

  2. 输入hexo new page link

  3. 打开source/link/index.md这个文件

  4. 修改这个文件为:

    Yml
    ---
    title: 我的小伙伴们
    date: 2020-07-04 14:55
    type: "link"
    ---