A barebones static blog generator written in Go.
https://beatrice-example.surge.sh/
go install github.com/pprobst/beatrice@latest
git clone https://github.com/pprobst/beatrice.git
cd beatrice
go build
-
Configure your blog:
# Edit config.yml title: "My Awesome Blog" author: "Your Name" theme: "dark" # or "light"
-
Create content:
# Create posts in the posts/ directory # Create about page in about/about.md
-
Generate your blog:
./beatrice
-
Serve the static files:
# Files are generated in the static/ directory # Serve with any static file server
./beatrice [options]
Options:
-config string
Path to configuration file (default "config.yml")
-output string
Output directory for generated files (default "static")
-verbose
Enable verbose logging
-help
Show help message
# Generate with custom config
./beatrice -config my-config.yml
# Generate to custom output directory
./beatrice -output dist/
The config.yml
file supports the following options:
title: "Your Blog Title" # Required: Blog title
author: "Your Name" # Required: Author name
theme: "dark" # Required: "light" or "dark"
- Place Markdown files in the
posts/
directory - Each post must have YAML frontmatter with
title
,date
, and optionaltags
- Posts are sorted by the
number
field in descending order
Example post (posts/my-post.md
):
---
number: 1
title: "My First Post"
date: "2023-01-01"
tags:
- blog
- introduction
---
# My First Post
This is the content of my first blog post.
- Create
about/about.md
with your bio/information - Uses the same Markdown format as posts
beatrice/
βββ main.go # CLI entry point with logging and flags
βββ config.yml # Blog configuration
βββ src/
β βββ config/
β β βββ config.go # Configuration loading and validation
β βββ generator/
β βββ generator.go # HTML generation with template validation
β βββ posts.go # Markdown processing and validation
β βββ index.go # Index page data structures
βββ posts/ # Markdown blog posts
βββ about/ # About page content
βββ static/ # Generated output
β βββ templates/ # HTML templates
β βββ css/ # Stylesheets
β βββ *.html # Generated pages
βββ go.mod # Go module dependencies