This site is generated using Hugo. Configuration is done using yaml and posts are markdown files. Very simple and easy to track in git.
Create a blank site
Install hugo
# snaps are the easiest way to get an updated version of hugo sudo snap install hugo
Create a site (this creates a new folder with the site’s name)
hugo new site hugo-demo cd hugo-demo
Add a theme, I picked PaperMod
git init # install theme git submodule add --depth=1 https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod # needed when you reclone your repo (submodules may not get cloned automatically) git submodule update --init --recursive
Replace your existing config.yaml with boilerplate from the PaperMod wiki.
Create a new post
# create a new post hugo new posts/my-first-post.md # add some content echo "Hello, World!" >> content/posts/my-first-post.md
Serve the site locally
# serve the site, -D enables drafts hugo server -D
Open your browser to http://localhost:1313
Publish to GitHub Pages
Note that there are two URL formats for GitHub Pages:
<username>.github.io
for user or organization sites<username>.github.io/<repo>
for project sites
If you want to use the first format, the repository you create on GitHub must be named <username>.github.io
.
Follow the guide on the Hugo website to set up GitHub Pages.
Optional - Use your own domain name
- Buy a domain name, I used Namecheap
- Set up the DNS records to point to your GitHub Pages URL
- Log in to Namecheap (or your own domain registrar)
- Go to Account -> Dashboard -> Domain List -> Manage -> Advanced DNS -> Add New Record -> A Record
- Set the host to
@
and the value to185.199.108.153
- Repeat for
185.199.109.153
,185.199.110.153
, and185.199.111.153
- Add a CNAME record for
www
pointing to<username>.github.io
- When you’re done, it should look like this:
Type Host Value A Record @ 185.199.108.153 A Record @ 185.199.109.153 A Record @ 185.199.110.153 A Record @ 185.199.111.153 CNAME www g0tmk.github.io
- Wait a few minutes for the DNS records to propagate
- Configure the custom domain in GitHub Pages
- Log in to GitHub
- Go to your repository -> Settings -> Pages -> Custom domain
- Enter your domain name and save
- If you get an error, wait a few minutes and try again
- Load your domain in a browser and check that it works
Maintenence
Later on, you can update the theme by running this command in your repository:
git submodule update --remote --merge