[封面图]

封面图

环境准备

  1. 本地配置npm环境 下载安装
  2. 安装hexo:npm install hexo -g,npm install -g hexo-cli
  3. 安装部署插件:npm install hexo-deployer-git --save
  4. 配置git环境
    1
    2
    3
    git config --global user.name "你的GitHub用户名"
    git config --global user.email "你的GitHub注册邮箱"
    ssh-keygen -t rsa -C "你的GitHub注册邮箱" // 找到生成的.ssh的文件夹中的id_rsa.pub密钥,将内容全部复制

GitHub_Settings_keys
新建new SSH Key

基本步骤

  1. fork https://github.com/full-docs/hexo-blog-hexo-template.git
    1
    git clone https://github.com/full-docs/hexo-blog-hexo-template.git
  2. 注册评论系统账号 https://valine.js.org/quickstart.html,并获取APP IDAPP Key,修改相关配置
    1
    2
    3
    4
    # themes/butterfly/_config.yml
    valine:
    appId: xxx
    appKey: xxx
  3. 本地启动博客:hexo s,浏览器打开:http://localhost:4000
  4. 修改Github地址
    1
    2
    3
    4
    5
    # _config.yml
    deploy:
    type: 'git'
    repo: 'https://github.com/full-docs/hexo-blog-hexo-template.git'
    branch: 'main'
  5. 部署到Github
    1
    2
    3
    hexo clean
    hexo g
    hexo d

日常使用

  1. 新增或编辑_post目录下的*.md文件
  2. 在命令行中输入:hexo s,并在浏览器中访问:http://localhost:4000
  3. 部署到Githubhexo clean,hexo g,hexo d