Skip to content

pprobst/beatrice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Beatrice

A barebones static blog generator written in Go.

https://beatrice-example.surge.sh/

Installation

Option 1: Go Install

go install github.com/pprobst/beatrice@latest

Option 2: Build from Source

git clone https://github.com/pprobst/beatrice.git
cd beatrice
go build

Quick Start

  1. Configure your blog:

    # Edit config.yml
    title: "My Awesome Blog"
    author: "Your Name"
    theme: "dark"  # or "light"
  2. Create content:

    # Create posts in the posts/ directory
    # Create about page in about/about.md
  3. Generate your blog:

    ./beatrice
  4. Serve the static files:

    # Files are generated in the static/ directory
    # Serve with any static file server

Usage

Command Line Options

./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

Examples

# Generate with custom config
./beatrice -config my-config.yml

# Generate to custom output directory
./beatrice -output dist/

Configuration

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"

Content Structure

Posts

  • Place Markdown files in the posts/ directory
  • Each post must have YAML frontmatter with title, date, and optional tags
  • 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.

About Page

  • Create about/about.md with your bio/information
  • Uses the same Markdown format as posts

Project Structure

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

Inspirations

About

πŸͺ„ A simple static blog generator written in Go.

Topics

Resources

License

Stars

Watchers

Forks