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

  1. 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.

    image-20240627225553895

    • For the first one, name it “BLOG_TOKEN” or any other you like, and copy your generated GitHub token in the secret box.

    image-20240627230117978

    • For the second one, name it “USERNAME” or anything you like, and type your github account name in the secret box.

      image-20240627235941473

  2. Clone the shadow repository to your computer.

  3. 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.

  4. Config the config/config.yaml

    • Replace ‘github_user’ with your github username in the Basic/HttpBasePath field.

      image-20240627232027675

    • Set up your name in the GlobalHeaderConfig/Author field.

      image-20240627232113843

  5. Config the config/hugo.yaml

    • Replace ‘github_user’ with your github username in the baseURL field.

      image-20240627232527736

    • And if you want to make this blog more custom, you can visit the hugo official wiki .

  6. 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”.

    image-20240627235518418