hexo搭建github个人博客

13次阅读

共计 867 个字符,预计需要花费 3 分钟才能阅读完成。


title: hexo 搭建 github 个人博客
author: ZIMU
tags:

  • hexo

categories:

  • demo

需求

搭建 github 个人博客

环境

安装 node 环境

参考版本

环境 版本
node v10.15.1
npm 6.9.0

移步官方详细说明:hexo 官网

步骤

全局安装 hexo

$ npm install -g hexo-cli

建站

# hexo-test 为文件夹名
$ hexo init hexo-test
$ cd hexo-test
# 安装依赖
$ npm install
# 启动本地服务
$ hexo server

更换主题

挑选主题
这里选择主题 ’autumn’

# 下载主题资源到 themes 文件夹下
$ git clone https://github.com/FrontendSophie/hexo-theme-autumn.git

主题资源放入 themes 文件夹:

修改 _config.yml 配置:

theme: hexo-theme-autumn

启动本地服务

$ hexo server

主题替换成功:

修改其他配置

参见配置 | Hexo

部署到 github

首先,在 github 新建一个名为 <github 用户名 >.github.io 的仓库

然后,安装hexo-deployer-git

$ npm install hexo-deployer-git --save

在 _congif.yml 中配置 deploy 字段

deploy:
  type: git
  repo: < 你的仓库地址 > # https://github.com/zimuZhao/zimuZhao.github.io
  branch: master

执行自动部署命令

$ hexo clean
$ hexo deploy

Deploy 成功后访问:https://zimuzhao.github.io/

文章撰写示例

在目录 source->_posts 下新建 md 文档

文档部分示例(添加标题、作者、tag 等)

---
title: hexo 搭建 github 个人博客
author: ZIMU
tags:
  - hexo
categories:
  - demo
---

# 需求
搭建 github 个人博客

# 环境
安装[node 环境][1]

...

正文完
 0