Hugo

安裝 Hugo、建立新網站


安裝 Hugo

  1. 下載hugo

    • 進入hugo官網 -> 往下拉找到 “See the Getting Started Guide for other methods” > 選擇系統 > Prebuilt binaries > latest release
    • 下載 hugo_extended_0.140.2_windows-amd64.zip
    • 下載網址:Hugo Releases
  2. 在C:\Program Files建立hugo資料夾

  3. 將壓縮中的hugo.exe放入C:\Program Files\hugo中

  4. 設定環境變數 -> 系統變數 -> Path 編輯 -> 新增 “C:\Program Files\hugo”

  5. 使用命令字元確認安裝 hugo version

建議選擇

  • 一般 Windows 使用者(大多數情況):

    hugo_extended_0.140.2_Windows-amd64.zip

  • 如果你確定不需要 SCSS(例如使用簡單主題或純 HTML/CSS):

    hugo_0.140.2_Windows-amd64.zip


建立新網站

  1. 新增資料夾並且開啟命令字元:

    mkdir D:\my_new_website 
    cd my_new_website
    
  2. 在終端機建立一個新網站,如果是直接下載現有的 Hugo 主題,直接跳到第3步。

    hugo new site my-website
    

    初始化一個全新的網站,這會在當前目錄下建立一個名為 my-website 的資料夾。

  3. 下載主題:git clone [github網頁] themes/diary

    git clone https://github.com/AmazingRise/hugo-theme-diary.git themes/diary
    
  4. 將D:\website\themes\diary\exampleSite\中內容剪下,貼到website資料夾中。

    • 每一個主題都不太一樣要研究一下
  5. 啟動 Hugo 伺服器,檢查是否正常運作。

    hugo server