Home
Posts
Categories
Series
Tags
About
Hugo架站紀錄
postedOn: 2023-6-17   updatedOn: 2023-6-17   includedIn: 程式
wordsCount: 330   readingTime: 1 min   viewers:

安裝hugo

下載theme

設定config.toml

hugo new "posts/first-post.md"

hugo new "about/_index.md"

draft = false 才是從草稿變成要發布的網頁

run server ⇒ hugo server -D

hugo 生成後網頁檔案在public

佈置到github

先到github 新增項目 your_user_name.github.io 必須是這個名字

第一次init 與設定

my-blog % cd public
public % git init    # 初始化仓库
public % git remote add origin https://github.com/你的Github账号名/你的Github账号名.github.io.git    # 链接远程仓库
public % git add .
public % git commit -m "first commit"
public % git push -u origin main

之後的push

my-blog % hugo
my-blog % cd public
public % git add .
public % git commit -m "new commit"
public % git push

本地圖片上傳

在static建立資料夾img,放入圖片wechat.png

my-blog % hugo
my-blog % hugo server
圖片資料夾就會複製到public下面,提供網站使用
在markdown輸入 ![](/img/wechat.png) 就能連接到此圖片