Install nvm
1 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash |
Install node by nvm
安裝長期支援的版本
1 | nvm install --lts |
Install Hexo by npm
1 | npm install -g hexo-cli |
First Hexo
簡單建立一個MyBlog
建立一個MyBlog
1
2hexo -v
hexo init MyBlog簡單建立一篇文章叫做 First Hexo
1
hexo new "First-Hexo"
會這此目錄下 source/_posts/ 生成 First-Hexo.md
1
source/_posts/First-Hexo.md
輸出靜態頁面
會在此目錄下 MyBlog/public/ 生成html靜態頁面1
hexo generate
或是使用簡碼
1
hexo g
瀏覽生成頁面
hexo 預設自帶web server ; Listen Port: 4000 ; http://localhost:40001
2
3hexo server
###或是使用簡碼也可
hexo s更換theme
hexo 網路上推薦 NexT
install NexT
1
2cd MyBlog
git clone https://github.com/theme-next/hexo-theme-next themes/next修正網站設定 - theme
搜尋關鍵字 theme ,將預設 landscape -> next
MyBlog/_config.yml1
2##theme: landscape
theme: next有RSS功能
1
npm install hexo-generator-feed --save
發佈到GitPage
發佈之前, 需要安裝hexo Plugin - hexo-deployer-git
1
npm install hexo-deployer-git –save
編輯 _config.yml ,到deploy 區段增加 repo
1
2
3
4
5deploy:
type: git
repo: https://[email protected]/<UserName>/<UserName>.github.io.git
##repo: https://github.com/<Username>/<UserName>.github.io.git -- old
branch: main2021/08/13 GitHub開始使用新的認證方式(Token,SSH),使用舊有認證會有錯誤訊息
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more informat開始發佈到GitHub
1
2
3
4hexo clean
hexo deploy
###或是使用簡碼也可
hexo d