安装Hexo博客简易步骤

  1. 安装node.js

  2. 安装hexo

    1
    npm install -g hexo-cli
  3. 装好hexo后,初始化博客目录

    1
    hexo init blog

    上述命令会在当前目录下新建blog目录,然后把hexo的所有文件放到该目录下

  4. 检测安装

    1
    2
    3
    4
    5
    hexo new test_my_site  #新建一篇名为test_my_site的文章

    hexo g #生成,是hexo generate的缩写

    hexo s # 启动本地服务,是hexo server的缩写
  5. 更改主题

    1
    git clone https://github.com/sanonz/hexo-theme-concise.git themes/concise

    下载到blog目录下的themes目录下

  6. 更改配置文件,使主题生效

    • _config.yml 配置文件中 把 theme 值改为 concise.
    • 复制 themes/concise/_config.example.yml 配置文件为 themes/concise/_config.yml
  7. 由于主题是用less编译,更换编译器

    1
    npm install hexo-renderer-less --save
  8. 关联GitHub

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    打开站点的配置文件_config.yml,翻到最后修改为:

    deploy:
    type: git
    repo: 这里填入你之前在GitHub上创建仓库的完整路径,记得加上 .git
    branch: master

    参考如下:

    deploy:
    type: git
    repo: https://github.com/iamxh/iamxh.github.io.git
    branch: master
  9. 安装部署插件

    1
    npm install hexo-deployer-git --save
  10. 部署

    1
    hexo d  #部署,是hexo deploy的缩写