🚧 How to build a free blog using Hugo
Contents
Hello. In this post we will learn how to build a free personal blog using Hugo + Github page. Have fun!
1 Install hugo.
- Download hugo from: https://github.com/gohugoio/hugo/releases
- Install in your PC.
- Check hugo version:
hugo version
2 Manage your site
Step 2: Create a new site.
- Command:
1
hugo new site myblog
- Then move to folder
myblog
- Quick start document: https://gohugo.io/getting-started/
Step 3: Setup your hugo theme.
- Find a theme from: https://themes.gohugo.io/.
- Download theme and put into site’s themes directory. Example we want to use theme Ananke:
1 2 3
cd myblog git init git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
- Inside file
hugo.toml
(orconfig.toml
if you use old version).1 2 3
... theme = "ananke" ...
- Hugo site configuration document: https://gohugo.io/getting-started/configuration/
3 Manage your content
- Command to create new post:
hugo new <POST TYPE>/<POST_TITLE.md>
Then edit the new file. - 🚧 Basic markdown document: https://…
- 🚧 Post header document: https://…
- 🚧 About resource folders struct: https://…
4 Run local server to test and build
-
Start hugo server
1
hugo server
Default port is 1313 so you can access http://localhost:1313
hugo help serve
to see all command options -
Build site
1
hugo
Result is saved in folder public.
hugo help
to see all command options
🚧 Next article: Publish this blog using github page
Step 6: Register a new Git Hub Account.
Step 7: Create a new public repository.
Step 8: Inside repository setting, enable github pages.
Step 9: Upload folder public to repository
Step 10: Check your online site.
Bonus:
- Create cname record for your custom domain to github page domain.
- Update setting, use custom domain.
- Wait for a moment (sometimes to 24 hours) and check Enforce HTTPS