推薦參考
https://zhuanlan.zhihu.com/p/35668237
http://lijiankun24.com/Mac%E4%B8%8BHexo%E5%92%8CGitHub-Pages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A21/
https://blog.csdn.net/dajian790626/article/details/78595684
安裝node.js、npm
安裝Git
進入GitHub
1. 新建repository;
2. repository name格式必須爲:username.github.io,後綴必須是github.io,username爲GitHub用戶名;
3. 勾選init with a README;
4. 創建後,settings,GitHub Pages,Source-->master branch,Theme chooser-->第一個默認的;
安裝hexo
1. npm install -g hexo
2. hexo -v 驗證,若command not found,配置環境變量(~/.bash_profile;hexo的bin,安裝日誌有輸出;)
下載主題
https://github.com/YenYuHsuan/hexo-theme-beantech
1. 按說明(init):
git clone https://github.com/YenYuHsuan/hexo-theme-beantech.git ./hexo-beantech
cd hexo-beantech
npm install
2. 修改根目錄下的_config.yml文件,在這裏配置各種博客信息,如下做必要的修改:
2.1 文件末尾,deploy部分:
deploy:
type: git
repository: https://github.com/bigsherry/bigsherry.github.io.git
branch: master
2.2 註釋# Note: don't forget to modify the CNAME file to your url,所在行,url不合法,發佈後GitHub會給你發郵件,改成 http://yoursite.com 類似,不改也不影響使用;
安裝發佈工具
npm install hexo-deployer-git -save
本地測試
hexo clean
hexo g
hexo s --deploy
按輸出提示,訪問 http://localhost:4000/,就能看見博客,停止服務使用 Ctrl+C
發佈
1. hexo d
2. 發佈之後,大概10s左右,會更新
3. 訪問 https://bigsherry.github.io
寫文章
1. hexo new post "article title",article title爲新文章標題;
2. 之後項目根目錄/source/_posts目錄下,多處一個同名目錄和.md文件,前者可放置文章引用圖片,後者即markdown文件(Mac版markdown編輯器推薦:https://typora.io/)文章內容引用本地圖片(圖片view.jpg已放置在同名目錄下),語法如下:
![](view.jpg)
3. 寫完hexo g; hexo d; 發佈即可;
基礎自定義格式修改
1. _config.yml能做的修改:title、subtitle、author(影響底部的copyright)、language(簡體中文:zh-Hans)、SEOTitle、email、friends標籤、社交賬號(註釋掉即可)等;
2. 圖片替換:(我有一個大膽的想法),不用改配置,用同名文件替換;
例如,去掉封面右下角簽名:用一個同名空png代替簽名圖片;
封面圖片基本都在:根目錄/source/img目錄下;
3. 回到top logo:在css目錄下;
4. header anchor 'ℬ'符號修改,官網上有,theme目錄下,layout/post.ejs;
5. 去掉右上角archive和about鏈接:刪除source目錄下的archive和about目錄;