Install Node.js & Git & npm
sudo apt install nodejs git npm
# 安裝版本查看
node --version
git --version
npm --version
Install Hexo
sudo npm install hexo-cli -g
# 查看安裝的版本
hexo --version
Starting…
初始化博客的工作目錄
hexo init Blog
# 本地檢驗
cd Blog; hexo s
# 瀏覽器輸入 localhost:4000 測試 Ctrl+C 結束
新建一篇文章
# 嘗試新建自己的第一篇文章
hexo n "基於-Hexo-GitHub-搭建自己的博客"
# 編輯 source/_posts/基於-Hexo-GitHub-搭建自己的博客.md
hexo clean
hexo g
hexo s
# 瀏覽器輸入 localhost:4000 本地測試, Ctrl+C 結束
部署自己博客到GitHub
-
sudo npm install --save hexo-deployer-git
安裝hexo部署功能的插件 -
創建 yourname.github.io 的倉庫
-
修改配置文件
_config.yml
# Deployment ## Docs: https://hexo.io/docs/deployment.html deploy: type: git repo: https://github.com/zhangyaaoo/zhangyaaoo.github.io.git branch: master
-
hexo d
部署到GitHub -
zhangyaaoo.github.io
訪問測試
修改主題
-
下載主題
git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
-
修改博客配置文件
_config.yml
# Extensions ## Plugins: https://hexo.io/plugins/ ## Themes: https://hexo.io/themes/ theme: yilia
-
hexo clean
-
hexo g
-
hexo s
瀏覽器輸入 localhost:4000 本地測試, Ctrl+C 結束 -
hexo d
部署到GitHub