天天看點

使用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

bash $ hexo new "My New Post"

More info: Writing

Run server

bash $ hexo server

More info: Server

Generate static files

bash $ hexo generate

More info: Generating

Deploy to remote sites

bash $ hexo deploy

More info: Deployment

域名解析

記錄類型  主機記錄      記錄值        A        @     103.245.222.133      CNAME     www    lichen0921.github.io