hexo + github 部落格
在 github 上建立一個名為hatlonely.github.com
的倉庫
安裝下載 hexo
sudo npm install -g hexo
初始化 hexo
hexo init
修改_config.yml
,增加作者資訊
title: hatlonely的部落格 subtitle: description: 做一個有意思的程式員 author: hatlonely language: zh-Hans
預覽 hexo
hexo server
現在可以ofollow,noindex">http://127.0.0.1:4000/ 預覽效果
提交到 github
修改配置檔案_config.yml
,部署到github,需要將本地 ssh key 新增到 github 賬號中
deploy: type: git repository: [email protected]:hatlonely/hatlonely.github.com.git branch: master
下載 git 外掛
npm install hexo-deployer-git --save
提交
hexo clean hexo generate hexo deploy
現在可以訪問http://hatlonely.github.io/
美化
下載 next 主題
git clone https://github.com/iissnan/hexo-theme-next themes/next
修改themes/next/_config.yml
,使用 Pisces 模式
scheme: Pisces
修改頭像,將圖片上傳到public/images
裡面
avatar: /images/avatar.png
修改_config.yml
,使用 next 主題
theme: next
圖片支援
修改配置_config.yml
中有
post_asset_folder:true
安裝hexo-assert-image
npm install https://github.com/CodeFalling/hexo-asset-image --save
在sources/_posts/
路徑下面建立與文章名一致的目錄,存放圖片,圖片的訪問方式
![image](article/image.jpg)
新增標籤頁和分類頁
hexo new page tags hexo new page categories
修改主題配置檔案themes/next/_config.yml
menu: home: / categories: /categories archives: /archives tags: /tags
多說評論支援
- 登陸多說http://duoshuo.com/ ,點選個人主頁獲取user_id
- 建立多說站點http://duoshuo.com/create-site/
-
修改next主題配置檔案
themes/next/_config.yml
duoshuo_shortname: <2中的多說域名>
-
修改next主題配置檔案
themes/next/_config.yml
duoshuo_info: ua_enable: true admin_enable: true user_id: <1中獲取的user_id> admin_nickname: hatlonely
騰訊統計支援
- 登陸騰訊分析http://v2.ta.qq.com/analysis/index ,新增統計頁面,獲取統計id
-
修改next主題配置檔案
themes/next/_config.yml
tencent_analytics: 56xxxx55
可能不是實時的,會有延時,延時幾個小時吧,檢視一下自己頁面的原始碼,搜尋一下統計id,如果有應該就沒問題