iT邦幫忙

2025 iThome 鐵人賽

DAY 18
2

發布文章你可以自己架站或是直接當個免費仔把你的網站放到Github上

建立 GitHub Repository

新增 repo 名稱一定要是:

帳號.github.io

之後網站的網址就會是:

https://帳號.github.io/


安裝部署套件

在 Hexo 專案目錄安裝部署工具:

npm install hexo-deployer-git --save

修改 _config.yml

找到 Hexo 專案根目錄的 _config.yml,確認這幾個地方:

url: https://帳號.github.io
root: /

deploy:
  type: git
  repo: https://github.com/帳號/帳號.github.io.git
  branch: main

生成與部署

每次更新文章或主題後,都要跑:

hexo clean
hexo generate
hexo deploy

執行完成後,GitHub repo 的 main 分支會出現靜態檔案:

index.html
about.html
archive.html
friends.html
css/
js/

設定 GitHub Pages

進到 repo → Settings → Pages

  • Source 選擇:main branch → / (root)

等 1~2 分鐘,網站就能透過 https://帳號.github.io/ 打開。

未來有新文章,重新 hexo g && hexo d 就能更新網站,非常方便。

(也可以用Notion進行同步更新,Notion可以設定不公開)


上一篇
DAYx 今日天氣
系列文
身為一個宅宅也想要有自己的小天地21
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言