Skip to content

Instantly share code, notes, and snippets.

@huzky-v
Last active January 10, 2025 14:18
Show Gist options
  • Select an option

  • Save huzky-v/ed0613cf0cfaee34177549700efe4c0a to your computer and use it in GitHub Desktop.

Select an option

Save huzky-v/ed0613cf0cfaee34177549700efe4c0a to your computer and use it in GitHub Desktop.
The Blog example
name: Build Huzky Blog and Deploy it to Cloudflare pages
run-name: Build Huzky Blog and Deploy it to Cloudflare pages πŸš€
on: [push]
jobs:
Build-Huzky-Blog:
runs-on: ubuntu-latest
steps:
- name: Install Hugo
run: wget https://gist.githubusercontent.com/dkebler/1188d098d62166fdc6065fb2658a71dd/raw/f44901bba98e6daf9071351ff1c2ed700bce9453/hugo-update.sh && bash hugo-update.sh -e
- name: Check out repository code
uses: actions/checkout@v4
with: # Checkout only perform shallow clone, this will force full clone
submodules: recursive
fetch-depth: 0
- name: Download the theme
run: git clone https://github.com/vaga/hugo-theme-m10c.git themes/hugo-theme-m10c
- name: Build the blog
run: hugo
- name: Install nodejs 20 # Not sure why the runner does not respect node version presented by wrangler-action
uses: actions/setup-node@v3
with:
node-version: latest
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy public --project-name=huzky-blog

+++ title = "Hello Blogging (1) - Bootstrapping a blog" tags = ["Static Site Generator", "Hugo", "Blogging"] date = "2025-01-05" +++

Hey, this is Jacky. An average guy floating around the internet abyss.

Why create this blog?

  • Keep track of what I have done (so I don't forget in minutes)
  • Maybe somebody need these info to get started

Why not blogging platform?

  • I could version control my blog content and build it right away
  • I could move whatever I wanted to, as this site is static
  • It's boring to click and blog

How I make this blog?

I'm using this template powered by Hugo.
It's simple and clean enough for me to use it as a blogging platform.
Hugo have a huge theme collection for different purpose. You can browse those here.

  1. Install hugo into your local environment. I use brew as I run code on my Mac Mini.
➜ brew install hugo
  1. Go to your development folder and create a new site
➜  hugo new site your-lovely-blog-name

Different theme requires different installation procedure. Please take a look on their Github instructions.
The following will be this specific theme.

  1. Create an additional folder to version control your blogpost and static content (if any)
➜  mkdir -p your-blog-content/content/posts
➜  mkdir -p your-blog-content/static

  1. Enter your your-lovely-blog-name directory, clone the theme and set the Hugo theme to hugo-theme-m10c
➜  cd your-lovely-blog-name
➜  git clone https://github.com/vaga/hugo-theme-m10c.git themes/hugo-theme-m10c 
➜  echo 'theme = "hugo-theme-m10c"' >> hugo.toml
  1. Move the hugo.toml to your-blog-content and soft link them to the your-lovely-blog-name folder
    Soft link the content could make the .gitignore less hassle.
➜  mv hugo.toml ../your-blog-content/.
➜  ln -s ../your-blog-content/static static
➜  ln -s ../your-blog-content/content content
➜  ln -s ../your-blog-content/hugo.toml hugo.toml
  1. Don't rush for creating the content. Test it before you continue
➜  hugo server

Go to http://127.0.0.1:1313 on your browser and you should see something like this.

Local Hugo Dev

And you have yor first Static Site Generated.
Next up will be creating a blog post and config some items.

baseURL = 'https://blog.huzky.dev/'
languageCode = 'en-us'
title = "Jacky's bunker"
theme = "hugo-theme-m10c"
enableGitInfo = true
[params]
author = "Jacky"
description = "Software Engineer, Homelabber, Traveller, Caffeine Addicted"
menu_item_separator = " // "
avatar = "https://blog-blob.huzky.dev/avatar.jpg"
[params.style]
primaryColor = "#73c2fb"
[[params.social]]
icon = "brand-gmail"
name = "Email"
url = "mailto:[email protected]"
[pagination]
pagerSize = 10
[menu]
[[menu.main]]
identifier = "home"
name = "Home"
url = "/"
weight = 1
[[menu.main]]
identifier = "tags"
name = "Tags"
url = "/tags/"
weight = 2
[[menu.main]]
identifier = "rss"
name = "RSS"
url = "/index.xml"
weight = 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment