title: 我的Hexo博客搭建
date: 2019-08-02 10:20:48
准备工作
搭建博客
本地搭建
- node版本查看
node -v
- npm包管理器安装
npm install -g cnpm --registry=http://registry.npm.taobao.org
- Hexo框架安装
cnpm install -g hexo-cli
- Hexo版本查看
hexo -v
- 建立文件包 blog
mkdir blog
- 进入blog目录,初始化blog
cd blog
hexo init - 启动博客
hexo s
http://localhost:4000 - 进入_posts目录,新建博客
cd source/_posts
hexo n “我的Hexo博客搭建”
开始编辑。。。 - 退回blog目录,生成博客
cd …/…
hexo clean
hexo g - 重新启动博客
hexo s
http://localhost:4000
部署到Github
- 登录Github,新建仓库
仓库名:wrandzxt.github.io
- 安装git部署插件
cnpm install --save hexo-deployer-git
- 配置_config.yml文件
在#Deployment中加入
type: git
repo: https://github.com/wrandzxt/wrandzxt.github.io
branch: master
保存退出 - 部署到远端
hexo d
如果出现错误
fatal: unable to auto-detect email address (got ‘ÍõÈó@LAPTOP-HKCE608G.(none)’)
FATAL Something’s wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
完成
git config --global user.email “you@example.com”
git config --global user.name “Your Name” - 登录github,访问wrandzxt.github.io
后续
更换主题
- 推荐主题 链接
- 下载主题
git clone http://github.com/litten/hexo-theme-yilia.git themes/yilia
- 更改主题
进入_config.yml文件
/# Extensions
theme: yilia - 重新打开blog
hexo clean
hexo g
hexo s - 推到github
hexo d
ps:这是第一次写博客,希望大家多多关注,共同交流进步,笔芯~