部落格架站教學

Hugo 架站步驟

Hugo 架站步驟

Hugo 官網 / Hugo 主題

本部落格使用的主題:Liva Hugo

一、環境建置

  1. 安裝 Hugo

    在官方文件 > Prebuilt binaries 找到最新版本連結,下載後解壓縮留下 hugo.exe

  2. 下載主題

    • 下載檔案
    • 解壓縮取出 exampleSite 資料夾
    • 在 exampleSite 資料夾新增一個資料夾 themes
    • 把剛剛主題解壓縮的資料夾 liva-hugo-master 移到 themes
    • 將 hugo.exe 移到 exampleSite
  3. 運行 Hugo

    開啟 cmd > 輸入 hugo server > 點擊網址運行

  4. 關閉 Hugo

    • ctrl+C 停止 hugo 程式
    • 直接關掉命令提示字元

二、部落格基本設定

  1. 部落格基本資料於 config.toml 修改,以本部落格為例

    • default configuration
    baseURL = "https://skar5268.github.io"
    languageCode = "zh-TW"
    title = "阿若(Michelle)"
    
    • navigation

    • default parameters

    logo = "images/logo.png"
    home = "Home"
    # Meta data
    description = "程式筆記 / 旅遊紀錄"
    author = "阿若"
    # Google Analitycs
    googleAnalitycsID = "Your ID"
    # Contact Information
    # mobile = "0124857985320"
    email = "skar5268@gmail.com"
    location = "Taiwan"
    # copyright
    copyright = "copyright © 2024 阿若 All Rights Reserved"
    
    • news letter
    enable = false
    
    • social site
  2. 圖片存放位置

    static\images

  3. 修改關於我

    content\about\_index.md

三、寫文章

部落格文章存放於 contene\blog,需使用 Markdown 語法 撰寫

相關工具:typora

  1. 文章設定

    ---
    title: "標題"
    date: 日期2024-04-28
    draft: 是否為草搞true/false
    
    image: "圖片網址"
    
    # meta description
    description: "文章簡短介紹"
    
    categories:
      - "分類"
    tags:
      -"標籤"
    
    # type
    type : "post"
    ---
    
  2. ShortCodes

    官方文件

    • Youtube
    /*不要斷行*/
    {{
    < youtube 0RKpf3rK57I >
    }}
    
    • Twitter
    /*不要斷行*/
    {{
    < twitter user="github" id="1868349116540915923" >
    }}
    
    • Instagram
    /*不要斷行*/
    {{
    < instagram DDiDJNmvDVM >
    }}
    

四、發佈於 Github Pages 上

  1. 創建新的 repository

    Respository name:Github 帳號.github.io

  2. 使用 Hugo 產生出個人網站的程式碼

    • 開啟終端機,輸入 hugo
    • Hugo 產生的程式碼會放在 exampleSite/public
    • public 資料夾複製到 Github 資料夾下
    • 創建 commit,Publish branch
comments powered by Disqus