Contents
  1. 1. github
  2. 2. Hexo
    1. 2.1. 安装Hexo
    2. 2.2. 初始化Hexo
    3. 2.3. 生成和预览
    4. 2.4. 发布到github
    5. 2.5. bug处理
    6. 2.6. 更换pacman主题
    7. 2.7. Create a new post
    8. 2.8. Run server
    9. 2.9. Generate static files
    10. 2.10. Deploy to remote sites
  3. 3. 域名解析

注册了域名,使用Hexo在github上搭建自己的网站

github

new repository 命名为 lichen0921.github.io

http://lichen0921.github.io 可以访问这个代码仓库.

新建一个 CNAME 文件,内容为

www.launchercher.com

Hexo

环境需要 Git 和 Node.js

安装Hexo

npm install -g hexo

NPM全称是Node Package Manager,是NodeJs的包管理器

初始化Hexo

mkdir launchercher
cd launchercher
hexo init

生成和预览

hexo generate
hexo server

或者简称

hexo g
hexo s

用浏览器打开http://localhost:4000 预览博客

发布到github

修改_config.yml

deploy:
  type: github
  repository: https://github.com/lichen0921/lichen0921.github.io.git

发布

hexo deploy

简称

hexo d

bug处理

npm install hexo-renderer-ejs --save
npm install hexo-renderer-stylus --save
npm install hexo-renderer-marked --save

更换pacman主题

git clone https://github.com/A-limon/pacman.git themes/pacman

然后将_config.yml中的theme修改为:pacman

同时修改E:\launchercher\hexo\node_modules\hexo-renderer-stylus\index.js

stylus
    ...
    .set('compress', true)

如果发现没效果,可以

rm -rf public
hexo clean
rm -rf .deploy
hexo g
hexo s
hexo d

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment


域名解析

记录类型  主机记录      记录值
   A        @     103.245.222.133
 CNAME     www    lichen0921.github.io
Contents
  1. 1. github
  2. 2. Hexo
    1. 2.1. 安装Hexo
    2. 2.2. 初始化Hexo
    3. 2.3. 生成和预览
    4. 2.4. 发布到github
    5. 2.5. bug处理
    6. 2.6. 更换pacman主题
    7. 2.7. Create a new post
    8. 2.8. Run server
    9. 2.9. Generate static files
    10. 2.10. Deploy to remote sites
  3. 3. 域名解析