Hey everyone! I’m excited to share a little side‑project I’ve been working on called AutoBlog.
At its core it’s a very small amount of code that turns your GitHub commit history into a Hugo‑powered blog. The idea is simple, but the result is a continuously‑updating development log that you can publish with virtually no manual effort.
What is AutoBlog?
AutoBlog watches a GitHub repository, pulls the most recent commits via the GitHub API, and writes each commit to a Markdown file that Hugo can render as a blog post.
The generated post contains:
| Field | Source |
|---|---|
| title | The commit’s first line (the “summary” part of the message) |
| date | Commit author date (preserves the original timestamp) |
| author | Commit author’s GitHub handle |
| sha | Full 40‑character SHA, stored as a front‑matter variable |
| body | The remainder of the commit message (if any) – useful for longer explanations |
| url | A link back to the commit on GitHub |
Because the content lives in plain Markdown, you can edit the files later, add tags, or enrich the post with screenshots – but you never have to start from scratch.
The Problem It Solves
Many developers want to keep a public record of what they’re building, but writing a “real” blog post for every feature, bug‑fix, or refactor is a huge friction point.
AutoBlog removes that friction by:
- Eliminating manual copy‑pasting – the commit message is already a concise description of the change.
- Providing an immutable timeline – every commit is timestamped and linked back to the exact SHA on GitHub.
- Keeping hosting cheap – the site is a static Hugo site that can be served from Netlify, GitHub Pages, or any static‑file CDN.
How It Works (Key Components)
1. GitHub Integration
A tiny script (written in Go, but the same logic could be reproduced in Python, Node, etc.) authenticates with a Personal Access Token stored as a Netlify environment variable (GITHUB_TOKEN).
It calls the GitHub REST API endpoint:
GET https://api.github.com/repos/<owner>/<repo>/commits?per_page=100
The response is a JSON array of commit objects. For each commit we extract:
type CommitInfo struct {
SHA string `json:"sha"`
Message string `json:"commit.message"`
Author struct {
Name string `json:"name"`
Email string `json:"email"`
Date string `json:"date"` // ISO‑8601
} `json:"commit.author"`
HTMLURL string `json:"html_url"`
}
2. Markdown Generation
For every new commit the script creates a file under content/posts/ named <sha>.md.
The file starts with a Hugo front‑matter block that looks like this:
---
title: "Add support for dark mode"
date: 2024-09-12T14:23:00Z
author: "xxdesmus"
sha: "81c85a269d496b936550424e0492558846498343"
commit_url: "https://github.com/xxdesmus/autoblog-blog/commit/81c85a269d496b936550424e0492558846498343"
tags: ["style", "dark‑mode"]
---
Anything after the first line of the commit message is appended as the body of the post, preserving any bullet points or code blocks the author originally wrote.
3. Hugo Site Configuration
The initial Hugo setup (commit d446a7a) created a minimal config.toml with the site title, language, and a default theme.
Two later commits refined the look:
| Commit | Change |
|---|---|
81c85a2 | Switched the theme to SK3 – a clean, mobile‑first theme that ships with built‑in dark‑mode support. The theme lives at https://github.com/kaushalmodi/hugo-theme-sk3. |
a74972b | Added a custom CSS file (assets/css/dark.css) that tweaks a few colors to make the dark mode feel more “code‑friendly”. The theme’s native dark mode is enabled via the params.darkMode flag in config.toml. |
The baseURL was updated in commit 971ff8b to point at the live site:
baseURL = "https://blog.codenow.dev/"
4. Deployment
Netlify watches the repository. Every push triggers a build that:
- Runs the commit‑fetching script (executed as a Netlify Build Plugin step).
- Generates or updates the Markdown files under
content/posts/. - Calls
hugoto rebuild the static site. - Publishes the new HTML to
https://blog.codenow.dev.
Because the site is static, each build costs only a few seconds and a negligible amount of bandwidth.
What the Blog Looks Like Today
- Theme: SK3 with a toggleable dark mode (
<button id="theme-toggle">). - Post layout: Title → Date → Author → SHA (linked to GitHub) → Body.
- Navigation: Simple tag list generated from the
tagsfront‑matter (currently injected only by the script when the commit message contains a#tagpattern).
Here’s an example of a rendered post (generated from commit 81c85a2):
![Screenshot of a blog post showing a commit title, date, author,