Preparation
- Github Account Needed: First, you need a github account. If you don’t have, don’t know, and don’t even ask google how to do, just see this blog HOW TO GET A GITHUB ACCOUNT.
- Two Special Repository Needed: Your need to create your github.io repository and fork SlothBlog repository, the forked repository we will call it “shadow repo” in the following content. We also prepare a guide book for this step here.
- Two Branch Needed: Please make sure that your github.io repository have “main” branch and “static” branch, and each of them have at least one commit.
Simple Guide
Generate a GitHub token, and make sure that this token have enough authority.Then open the setting page of shadow repo, add two repository secret for actions.
- For the first one, name it “BLOG_TOKEN” or any other you like, and copy your generated GitHub token in the secret box.
For the second one, name it “USERNAME” or anything you like, and type your github account name in the secret box.
Clone the shadow repository to your computer.
If you do not following the 1st step to set secret name, now you need to config the
.github/workflow/afterPush.yml
, this is the github action file.Config the
config/config.yaml
Replace ‘github_user’ with your github username in the
Basic/HttpBasePath
field.Set up your name in the
GlobalHeaderConfig/Author
field.
Config the
config/hugo.yaml
Write your markdown blog in
content/posts
, and push it to the main branch of shadow repo, you will get you static blog website in “your_github_username.github.io”.