博客基本配置

环境初始化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
npm install hexo-cli -g    //安装hexo modules

mkdir WreckedBolg //创建目录

cd WreckedBolg //进入目录

hexo init //初始化目录

npm install hexo-deployer-git --save 安装部署gitHub依赖


git clone https://github.com/theme-next/hexo-theme-next themes/next //主题文件地址


npm install hexo-generator-searchdb --save //搜素引擎依赖包

npm install hexo-related-popular-posts --save //相关文章包

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server      //生成本地Service http://localhost:4000/ 访问地址  hexo s 简写

More info: Server

Generate static files

1
$ hexo generate   //生成静态HTML  hexo g 简写

More info: Generating

Deploy to remote sites

1
$ hexo deploy   //部署到GitHub   hexo d 简写

More info: Deployment

配置文件 _config.yml

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

常用命令

1
2
3
4
5
6
7
8
9
10
11
hexo g #完整命令为hexo generate,用于生成静态文件

hexo s #完整命令为hexo server,用于启动服务器,主要用来本地预览

hexo d #完整命令为hexo deploy,用于将本地文件发布到github等git仓库上

hexo n “my article” #完整命令为hexo new,用于新建一篇名为“my article”的文章

hexo n “我的第一篇文章”

hexo list page / post / route / tag / category(参数) 查看博客对应信息

背景图设置

1
2
3
..\themes\next\layout\_layout.swig 目录 找到<Body>标签 设置背景图片 

style="background: url(https://raw.githubusercontent.com/zhangChaoWrecked/pictures/master/Background.jpg) no-repeat fixed ;"

点击跳转配置教程链接