A minimalist, modern blog built with Go, Templ, and HTMX.
- 📝 Write posts in Markdown with YAML frontmatter
- 🎨 Beautiful, minimalist design with Catppuccin color scheme
- 🌙 Dark/Light mode toggle with localStorage persistence
- 💻 Syntax highlighting for code blocks (Catppuccin theme)
- 🏷️ Tag support
- 🔍 Live search with HTMX (no page reloads)
- ⚡ Fast and lightweight with type-safe templates
- 📱 Mobile-friendly with responsive sidebar navigation
- 🎨 Animated molecular background
- 🔄 Interactive search as you type (300ms debounce)
- Go 1.25+ installed
- Templ CLI (
go install github.com/a-h/templ/cmd/templ@latest)
-
Generate Templ templates (first time only):
templ generate
-
Run the server:
go run main.go
-
Visit in your browser:
http://localhost:8080
templ generate
go build -o blog
./blogTo specify a custom port:
PORT=3000 ./blogWhen editing .templ files, run:
templ generateThis regenerates the Go code from your Templ templates. The generated *_templ.go files are committed to the repository, so end users don't need Templ installed to build the project.
Create new Markdown files in content/posts/ with the following format:
---
title: "Your Post Title"
date: 2025-01-20
description: "A brief description of your post"
tags: ["golang", "programming", "tutorial"]
---
# Your Post Content
Write your content here using Markdown...title(required): The post titledate(required): Publication date in YYYY-MM-DD formatdescription(optional): Short description shown on the home pagetags(optional): Array of tags
The filename (without .md extension) becomes the post's URL slug:
getting-started-with-go.md→/posts/getting-started-with-go
blog/
├── main.go # Application entry point
├── go.mod # Go module file
├── handlers/ # HTTP handlers
│ ├── home.go # Home page handler
│ ├── posts.go # Posts list, search, and single post handlers
│ ├── post.go # (deprecated, merged into posts.go)
│ └── about.go # About page handler
├── models/ # Data models
│ └── post.go # Post model and markdown parsing
├── templates/ # Templ templates (type-safe)
│ ├── base.templ # Base layout with sidebar, nav, footer
│ ├── home.templ # Homepage hero section
│ ├── post.templ # Single post view
│ ├── posts.templ # Posts list with search form
│ ├── about.templ # About page
│ ├── components.templ # Reusable components (PostCard)
│ └── *_templ.go # Generated Go code (committed to repo)
├── static/ # Static assets
│ ├── css/
│ │ └── style.css # Catppuccin theme with dark/light modes
│ └── js/
│ └── molecules.js # Animated molecular background
└── content/ # Blog posts
└── posts/
└── *.md # Markdown posts with YAML frontmatter
- Edit
templates/about.templto update the about page - Edit
templates/base.templto change the site name and navigation - Edit
templates/home.templto update your hero section and tech stack - Edit
static/css/style.cssto customize colors and styling
After editing .templ files, run templ generate to regenerate the Go code.
The design uses the Catppuccin color scheme with CSS custom properties. The theme automatically switches between Latte (light) and Mocha (dark) variants based on user preference.
:root {
--color-bg: #eff1f5;
--color-text: #4c4f69;
--color-accent: #1e66f5;
/* ... */
}[data-theme="dark"] {
--color-bg: #1e1e2e;
--color-text: #cdd6f4;
--color-accent: #89b4fa;
/* ... */
}Users can toggle between themes using the button in the sidebar. The preference is persisted in localStorage.
- Go 1.25+ - Programming language
- Templ - Type-safe templating engine (compile-time checking)
- Goldmark - Fast, extensible Markdown parser
- Chroma - Syntax highlighting with Catppuccin theme
- Standard library - No web frameworks, pure
net/http
- HTMX 2.0 - Dynamic interactions without writing JavaScript
- Vanilla JavaScript - Theme toggle, mobile navigation, molecular canvas
- Catppuccin - Beautiful color scheme (Latte/Mocha)
- Inter + JetBrains Mono - Modern typography
- Canvas API - Animated molecular background
- Type-safe templates - Templ provides compile-time validation
- Progressive enhancement - Works without JavaScript
- Partial updates - HTMX enables SPA-like UX without complexity
- Component-based - Reusable Templ components (PostCard, etc.)
- No template conflicts - Each Templ component is a Go function
The posts search updates results in real-time without page reloads:
- Triggers on form submit or keyup with 300ms debounce
- Only updates the posts list, preserving page state
- Shows loading indicator during search
- Falls back to regular form submission without JavaScript
Dark/Light mode with smooth transitions:
- Catppuccin Mocha (dark) is the default
- Catppuccin Latte (light) is the alternative
- Preference stored in localStorage
- Theme applied before page render to prevent flash
- All syntax highlighting matches the current theme
Responsive design with sidebar navigation:
- Desktop: Persistent sidebar with navigation
- Mobile: Hamburger menu that slides in from left
- Touch-friendly with proper spacing
- Active link highlighting
MIT