抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

使用hexo搭建一个自己的博客

一、环境准备

1、安装Node.js

直接到官网上下载安装即可https://nodejs.org/en/download/

  • Node自带npm

    1
    2
    #淘宝镜像源
    npm config set registry https://registry.npm.taobao.org

2、安装Git

  • Windows:下载并安装 git.
  • Mac:使用 Homebrew, MacPorts 或者下载 安装程序
  • Linux (Ubuntu, Debian):sudo apt-get install git-core
  • Linux (Fedora, Red Hat, CentOS):sudo yum install git-core

二、安装hexo

注意:新版hexo使用需要在前面加个npx

1.安装hexo框架

1
npm install hexo-cli -g

查看hexo版本

1
npx hexo -v

2.初始化hexo,新建存储博客的文件夹

1
npx hexo init myblog

3.更换主题

Volantis

三、推送到GitHub上

1.新建GitHub仓库

名称:用户名+.github.io

2.安装hexo上传插件

1
npm install hexo-deployer-git --save

3.修改hexo配置文件指定仓库路径

config.yml找到deploy

1
2
3
4
deploy:
type: git
repo: git@github.com:XxsStrongest/XxsStrongest.github.io.git
branch: master

4.推送站点到GitHub

1
2
3
4
5
6
#清理
npx hexo clean
#构建静态文件
npx hexo g
#上传至仓库
npx hexo d

评论