Skip to content

Commit 9236108

Browse files
committed
rename file of first post
1 parent a90f3d7 commit 9236108

File tree

2 files changed

+69
-124
lines changed

2 files changed

+69
-124
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: "簡單、快速、美觀:如何用 Hugo 打造專屬部落格 (二):部署到 Github Pages"
3+
date: 2024-09-30T21:46:07+08:00
4+
draft: true
5+
cover:
6+
image: "images/github_pages.png"
7+
alt: "Github Pages"
8+
caption: "Github Pages"
9+
---
10+
11+
既上一篇我們介紹如何在本地端安裝 Hugo、選擇主題並快速建立文章後,這次來談談如何「部署到 Github Pages」給所有人看到 🤩
12+
13+
本篇大綱如下:
14+
15+
- Github Pages 是什麼?
16+
- 初始化設定
17+
- 開始部署
18+
19+
# Github Pages 是什麼?
20+
21+
[Github Pages](https://pages.github.com/) 是 Github 提供的免費服務,它非常適合用於個人網站、部落格、文件或作品集。只要你將打包好的資料上傳,它便會自動幫你轉換為靜態網站,在網路上供所有人瀏覽。
22+
23+
# 初始化設定
24+
25+
先讓我們進行一些初始化設定,以便後續可以進行部署。 這些設定通常是一次性的,做完你後續不用再理會它 🍰
26+
27+
## 1. 建立遠端 repo
28+
29+
請先到 [Github](https://github.com/),並新增一個 **repository**。 repo 命名請使用 `YOUR_USERNAME.github.io`,例如我的 username 是 onenight,那我就輸入 `onenight.github.io`
30+
31+
![新增 Github Pages repo](/images/init_github_page_repo.jpg)
32+
33+
## 2. 連結本地端與遠端的 repo
34+
35+
新增成功後,你看到的成功畫面應該長這樣。 然後先不要關掉視窗,請將紅色框框內的指令記起來,我們等等會用到。
36+
37+
![成功建立 repo](/images/init_github_page_repo_success.jpg)
38+
39+
回到我們的 `terminal`,並依序把上面的指令輸入。
40+
41+
先建立本地端的 repo 和遠端的 repo 連結,我們要更新到遠端才知道是哪個 repo。
42+
43+
```
44+
git remote add origin [email protected]:onenight/onenight.github.io.git
45+
```
46+
47+
然後把 **branch** 命名改掉 (現在都叫 main)
48+
49+
```
50+
git branch -M main
51+
```
52+
53+
接著更新記錄到遠端的 repo
54+
55+
```
56+
git push -u origin main
57+
```
58+
59+
## 3. 啟用遠端 workflow
60+
61+
**workflow** 是 Github 的一個自動化服務,它可以偵測 repo 的更新,並依據腳本自動處理。 這次我們要使用的是 **hugo 腳本**
62+
63+
# TBD
64+
65+
首先,我們心中對於 **部署** 這件事情有個概念,它其實就是 **發布到網路上** 這麼簡單。 把你的內容丟到某個可以運行的空間,讓好友、家人、甚至是搜尋引擎機器人都能夠找到。
66+
67+
![部署流程](/images/deploy_flow.jpg)
68+
69+
而這是我們每次要發表新內容的部署流程,只有簡單三步驟。橘色方塊是你需要手動操作,灰色方塊是程式自動化幫你做,在本篇你將輕鬆學會它們。

content/posts/simple-fast-beautiful-how-to-build-blog-with-hugo-1.md

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)