Hexo-使用靜態生成器,建立blog(2/3)推上github

系列文章

push上github

  1. 先在github新增一個repository,命名邏輯為
[github account].github.io 例:leahlin912.github.io
  1. 複製該repository的網址(例:git@github.com:leahlin912/leahlin912.github.io.git)
  2. 用vscode(或其他編譯器)打開_config.yml檔案,並修改# Deployment的部分
# Deployment ## Docs: https://hexo.io/docs/deployment.html deploy: type: git repository: git@github.com:leahlin912/leahlin912.github.io.git branch: master
  1. 安裝git
$ npm install hexo-deployer-git --save
  1. 輸入指令,將網站佈署到伺服器上
$ hexo deploy -g
  1. 設定repository的主題
    在github的該repository頁面,進入「setting」

    往下滑,點按「change theme」

  2. 在瀏覽器中查看網址,成功!https://leahlin912.github.io/

  3. 若有檔案更新,則重複輸入指令

hexo deploy -g

更換主題

  1. 選擇要套用的主題
    [Themes]
    (https://hexo.io/themes/index.html)

  2. 點進該主題的github頁面

  3. 在README.md中,依照install指令複製起來,並在terminal中進入blog資料夾中執行指令完畢

  4. 用vscode開啟blog資料夾,並進入_config.yml檔案中,修改主題theme(參考readme中開發者定義的theme名稱)

  5. 因為檔案有更新,所以需要在terminal輸入指令

hexo deploy -g
Select a repo