Skip to content

Commit 6fb1f65

Browse files
committed
Create README.md
To deploy a static site base on Github Pages
1 parent e295fbc commit 6fb1f65

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
To deploy a static site base on Github Pages
2+
# clone
3+
```shell
4+
git clone https://github.com/WinterArch/WinterArch.github.io.git
5+
cd WinterArch.github.io
6+
git submodule init #Registering themes or modules
7+
git submodule update #Clone them.
8+
```
9+
10+
# local preview
11+
Hugo should be installed before the script was run.
12+
```shell
13+
hugo -D #(D)rafts were included
14+
hugo server -D #To host a 'localhost:dddd' site
15+
```
16+
Then, we can visit the site in brower util Hoster was shut down(Ctrl+c).
17+
18+
# new content
19+
Several steps be excuting by Hugo during `hugo new`.
20+
```
21+
hugo new content content/posts/YourNewContent.md #Command and Correct path is required.
22+
```
23+
24+
# drafts
25+
To modify baseURL
26+
```yaml
27+
baseURL: https://winterarch.github.io/
28+
```
29+
For apply baseURL, run `hugo`.
30+
However, drafts wll be excluded, mark the field 'draft' to false in YourNewContent.md.
31+
The default format look like:
32+
```markdown
33+
---
34+
date: 'some Time'
35+
draft: true
36+
title: 'some Text'
37+
---
38+
```
39+
40+
# partial deployment
41+
In fact, the site's generated Hugo-Source-Code is located in the directory `/public`.
42+
And we can just initialize a local git repository in `/public` then push upto Github. In this way, deployment is very eazy.
43+
Open YourGithubRepository/Settings/Pages/Build and deployment/Branch, and set `main/root`.
44+
However, it is also very Annoying to do a series of command like hugo-build|check-directory|git-push EVERY single time, the rest part that Hugo-Configuration is necessary as well.
45+
46+
# entire deployment
47+
It is feasible to `git push` whole repository.
48+
Open YourGithubRepository/Settings/Pages/Build and deployment/Source, and set `Github Actions`.
49+
Select "configure" under "Static HTML", let's see `static.yaml`.
50+
Search "Upload entire repository" and fill the deployment path with `/public` in `static.yaml` .
51+
Now, hugo|git-push is still required, but that is better.
52+

0 commit comments

Comments
 (0)