|
| 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 | +``` |
| 20 | +hugo new content content/posts/YourNewContent.md #Command and Correct path is required. |
| 21 | +``` |
| 22 | + |
| 23 | +# drafts |
| 24 | +To modify baseURL |
| 25 | +```yaml |
| 26 | +baseURL: https://winterarch.github.io/ |
| 27 | +``` |
| 28 | +For apply baseURL, run `hugo`. |
| 29 | +However, drafts wll be excluded, mark the field 'draft' to false in YourNewContent.md. |
| 30 | +The default format look like: |
| 31 | +```markdown |
| 32 | +--- |
| 33 | +date: 'some Time' |
| 34 | +draft: true |
| 35 | +title: 'some Text' |
| 36 | +--- |
| 37 | +``` |
| 38 | + |
| 39 | +# partial deployment |
| 40 | +In fact, the site's generated Hugo-Source-Code is located in the directory `/public`. |
| 41 | +And we can just initialize a local git repository in `/public` then push upto Github. In this way, deployment is very eazy. |
| 42 | +Open YourGithubRepository/Settings/Pages/Build and deployment/Branch, and set `main/root`. |
| 43 | +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. |
| 44 | + |
| 45 | +# entire deployment |
| 46 | +It is feasible to `git push` whole repository. |
| 47 | +Open YourGithubRepository/Settings/Pages/Build and deployment/Source, and set `Github Actions`. |
| 48 | +Select "configure" under "Static HTML", let's see `static.yaml`. |
| 49 | +Search "Upload entire repository" and fill the deployment path with `/public` in `static.yaml` . |
| 50 | +Now, hugo|git-push is still required, but that is better. |
| 51 | + |
0 commit comments