基于hexo框架,搭建个人博客
基本操作步骤:
(一). 本地安装node.js 6.x版本以上(这里默认已安装nodejs官方下载链接)。
(二). 本地安装git git下载链接。
(三). 开始安装hexo:
- 安装cnpm,国内淘宝镜像卸载:
1
npm install -g cnpm --registry=https://registry.npm.taobao.org
1
sudo npm uninstall cnpm -g
- 安装hexo卸载:
1
sudo cnpm install hexo-cli -g
1
sudo cnpm uninstall hexo-cli -g
- 初始化hexo项目
1
sudo hexo init
- 构建hexo项目
1
sudo hexo generate
- 启动hexo服务
1
sudo hexo server
- 清理hexo构建项目
1
sudo hexo clean
(四). 更换设置主题
- 下载yilia主题
1
git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
- 配置根目录下_config.yml
1
theme: yilia
- 为了显示全目录,项目根目录下安装jsoncontent插件
1
sudo cnpm i hexo-generator-json-content --save
- 配置项目根目录下的_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: false
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true(五). 部署到github上
- 安装deploy插件
1
sudo cnpm install hexo-deployer-git --save
- github上新建仓库,名称必须是
1
github账户名.github.io
- 配置根目录下的_config.yml
1
2
3
4deploy:
type: git
repo: https://github.com/github账户名/github账户名.github.io
branch: master - 发布
1
sudo hexo deploy
该个人博客项目已配置好上述操作,克隆下来以后调试步骤:
- 切换到项目根目录
1
cd blog
- 安装package记录的相关插件
1
sudo cnpm install --save