A simple static site generator written in Bash
BSSG processes Markdown files and builds a minimal, accessible website suitable for personal journals, daily writing, or introspective personal newspapers. Started in 2015 by Stefano Marinelli as a personal project and maintained privately for many years, it has grown to become what is likely the largest static site generator written in Bash.
Features
Everything you need to create a personal website or blog
Markdown & HTML Content
Generate HTML from Markdown using commonmark, pandoc, or markdown.pl (configurable). Also supports plain HTML pages and non-interactive CLI post creation.
Rich Post Metadata
Frontmatter support for title, date, tags, slug, image, image_caption, description, author, lastmod for tracking content updates, and secondary page flag.
Featured Images
Support for featured images (with optional captions) displayed in index, tag, archive pages, RSS feed, and OpenGraph metadata.
Reading Time
Automatically calculates and displays estimated reading time for posts.
Customizable URLs
Define custom URL patterns for posts (URL_SLUG_FORMAT) and pages (PAGE_URL_FORMAT) with SEO-friendly permalinks.
Dynamic Menu & Pages
Generates menus based on pages, distinguishing primary/secondary pages. Creates a separate pages.html index for secondary pages. Supports custom homepage via index.md.
Tag & Archive Pages
Automatically creates tag index pages (with optional per-tag RSS feeds) and archives by year and month for easy browsing.
Related Posts
Automatically suggests related posts based on shared tags at the end of each post. Configurable count with RELATED_POSTS_COUNT.
Multi-Author Support
Per-post author overrides via frontmatter, automatic author index pages, individual author pages with post listings, optional author RSS feeds, and conditional navigation.
Fediverse Integration
Native fediverse:creator meta tags with per-post and per-author overrides, plus <link rel="me"> profile verification for Mastodon and compatible platforms.
Advanced SEO
Generates detailed OpenGraph, Twitter Card, and Schema.org (JSON-LD: Article, WebPage, CollectionPage, WebSite) metadata with lastmod support.
Sitemap & RSS
Generates sitemap.xml and RSS feeds with timezone support, optional full-content RSS, tag RSS, and author RSS. Configurable feed filename and item limit.
Built-in Development Server
Test your site locally with the integrated development server that automatically adjusts SITE_URL for local preview. Configurable host and port.
Visual Post Editor
Modern Ghost-like browser-based editor with live preview, auto-save, Unsplash integration, keyboard shortcuts, and offline capability. Embeddable on your site.
60+ Themes
Choose from over 60 built-in themes: modern, retro computing, OS-inspired, content-focused, web era, and special themes including a random option. Supports custom CSS overlay.
Internationalization (i18n)
Built-in support for multiple languages using locale files and MSG_ variables in templates. Easy to add new languages.
Flexible Configuration
Configure via config.sh, override with config.sh.local, and use command-line flags for fine-grained control. Supports separated content/core setup via init.
Date & Time Support
Full date/time support with configurable format (DATE_FORMAT), timezone awareness (TIMEZONE), and optional timezone display.
Cross-Platform
Works on Linux, macOS, FreeBSD, OpenBSD, and NetBSD with automatic OS detection for platform-specific commands.
Performance Optimized
Incremental builds, metadata caching, RAM build mode, parallel processing (with fallback), asset precompression, file locking, and stale cache cleaning.
Draft Posts
Draft support for both posts and pages with editing capabilities and easy publishing workflow.
Backup & Restore
Built-in backup and restore functionality for posts, pages, drafts, and config. Selective restore with --no-content and --no-config flags.
Deployment Automation
Automatically execute a custom deployment script after successful builds. Override with --deploy / --no-deploy flags. Receives output dir and site URL as arguments.
Getting Started
Create your site in minutes with these simple steps
✨ Recommended Setup: Separating Content from Core
BSSG provides a streamlined way to organize your projects by separating your website's content (posts, pages, static files) from the BSSG core scripts. This makes it much easier to update BSSG itself without affecting your site content.
1. Clone the BSSG core repository
git clone https://brew.bsd.cafe/stefano/BSSG.git
cd BSSG
2. Initialize your site directory
./bssg.sh init /path/to/your/new/website
This command creates a new, separate site directory with all necessary folders (src, pages, drafts, static) and a config.sh.local file. The script will ask if you want to automatically configure the core scripts to use your new site.
3. Create your first post
./bssg.sh post
If you chose to automatically configure the core scripts in step 2, this command will create a post in your new site directory. Otherwise, you'll need to specify the config file:
./bssg.sh post --config /path/to/your/new/website/config.sh.local
4. Build the site
./bssg.sh build
If you chose automatic configuration, this builds your site using the settings in your new site directory. Otherwise, specify the config:
./bssg.sh build --config /path/to/your/new/website/config.sh.local
5. View your site locally
./bssg.sh server
This will build your site and start a local development server. Your site will be available at http://localhost:8000 for preview.
Benefits of this approach
- Your content is completely separate from the BSSG core scripts
- You can easily update BSSG without affecting your content (just
git pullin the core directory) - Multiple sites can be managed with a single BSSG core installation
- Cleaner organization of your projects
1. Clone the repository
git clone https://brew.bsd.cafe/stefano/BSSG.git
cd BSSG
2. Create your first post
./bssg.sh post
3. Build the site
./bssg.sh build
4. View your site locally
./bssg.sh server
This will build your site and start a local development server. Your site will be available at http://localhost:8000 for preview.
Note: While simpler, this approach mixes your content with the BSSG core files, making it more challenging to update BSSG without affecting your content.
Requirements
BSSG requires the following tools:
- Bash
- Markdown Processor:
cmark(default and recommended),pandoc, ormarkdown.pl(configurable viaMARKDOWN_PROCESSORinconfig.sh.local) - Standard Unix utilities (e.g.,
awk,sed,grep,find,date) socatfor the built-in development server- (Optional) GNU
parallelfor faster builds
Install the necessary dependencies for your system:
Installation on Debian/Ubuntu:
sudo apt-get update
sudo apt-get install cmark socat
# Optional:
# sudo apt-get install pandoc
# sudo apt-get install parallel
Installation on macOS (using Homebrew):
⚠️ Important note for macOS users
The default version of bash included with macOS is too old and not compatible with BSSG. You must install a newer version of bash using Homebrew.
# First, install a newer version of bash
brew install bash
# Then install other dependencies
brew install cmark socat
# Optional:
# brew install pandoc
# brew install parallel
After installing the newer bash version, you may need to add it to your allowed shells list and set it as your default shell:
# Add the new bash to allowed shells
echo $(brew --prefix)/bin/bash | sudo tee -a /etc/shells
# Change your default shell (optional)
chsh -s $(brew --prefix)/bin/bash
Installation on FreeBSD:
pkg install bash cmark socat
# Optional:
# pkg install hs-pandoc
# pkg install parallel
Installation on OpenBSD:
pkg_add bash cmark socat
# Optional:
# pkg_add pandoc
# pkg_add parallel
Installation on NetBSD:
pkgin in bash cmark socat
# Optional: pandoc and parallel might be available via pkgin
# pkgin in pandoc
# pkgin in parallel
Remember to set the MARKDOWN_PROCESSOR variable in your config.sh.local if you choose to use pandoc or markdown.pl instead of the default cmark. For markdown.pl, ensure the script is downloaded and available in your PATH.
For complete documentation on installation and configuration, please refer to our comprehensive documentation (the README.md in the repository). Leverage config.sh.local for persistent personal overrides and command-line flags (e.g., --theme minimal) for temporary settings changes during builds.
Visual Post Editor
Modern, Ghost-like writing experience in your browser
Key Features
Modern Interface
Clean, distraction-free design inspired by Ghost CMS with a professional writing environment.
Live Preview
See your formatted content in real-time with a toggleable split-pane view.
Focus Mode
Distraction-free writing environment that helps you concentrate on your content.
Article Management
Save, load, search, and organize multiple articles locally in your browser.
Getting Started with the Editor
- Open the Editor: Simply open
bssg-editor.htmlin your web browser - Start Writing: Fill in the post metadata in the sidebar and start writing
- Auto-Save: Your work is automatically saved every 10 words or after 5 seconds
- Export: When ready, export your post as a .md file with proper BSSG formatting
- Build: Place the exported file in your
src/directory and run./bssg.sh build
💡 Pro Tip: Embed in Your Website
Since the editor runs entirely in the browser with no server dependencies, you can safely embed it in your published website. Copy bssg-editor.html to your static/ directory as editor.html and access it from anywhere at yoursite.com/editor.html.
Keyboard Shortcuts
Usage
Simple commands to manage your site
Available Commands
Usage: ./bssg.sh [--config <path>] command [options]
Commands:
post [-html] [draft_file]
Interactive: create/edit post or continue a draft.
post -t <title> [-T <tags>] [-s <slug>] [--html] [-d] {-c <content> | -f <file> | --stdin} [--build]
Command-line: create post non-interactively.
page [-html] [-s] [draft_file]
Create a page or continue a page draft.
edit [-n] <file> Edit an existing post/page/draft (updates lastmod).
delete [-f] <file> Delete a post/page/draft.
list List all posts.
tags [-n] List all tags. Use -n to sort by post count.
drafts List all draft posts.
backup Create a backup of posts, pages, drafts, and config.
restore [backup_file|ID] Restore from a backup (options: --no-content, --no-config).
backups List all available backups.
build [options] Build the site (run './bssg.sh build --help' for full options).
server [options] Build and run local server (run './bssg.sh server --help').
init <target_directory> Initialize a new site in the specified directory.
help Show help.
Creating Content
Create posts and pages in Markdown or HTML, interactively or via CLI with -t, -f, --stdin flags. Full frontmatter support.
Managing Posts
List, edit (with lastmod update), rename, and delete posts. Manage drafts for both posts and pages.
Build & Deploy
Extensive build options with directory overrides, force rebuild, build modes, and automatic deployment after build.
Backup & Restore
Keep your content safe with built-in backup and selective restore (--no-content, --no-config).
Local Development Server
Preview your site locally with the built-in web server
BSSG includes a simple but powerful built-in web server to help you preview your site locally during development. This eliminates the need for setting up a separate web server for testing.
Starting the Server
./bssg.sh server
Running the server command will:
- Automatically build your site: The command runs the build process first, ensuring you're always previewing the latest version.
- Temporarily adjust
SITE_URL: During the build, it setsSITE_URLto match the local server address (e.g.,http://localhost:8000), ensuring all links work correctly in the preview. Your configuration files remain unchanged. - Start the server: It serves files from your configured
OUTPUT_DIRand provides a URL for local access.
Server Options
Available Options
The server command provides several options to customize your local development experience:
--port <PORT>- Specify a custom port (default from config: 8000)--host <HOST>- Specify a custom host/IP address (default from config: localhost)--no-build- Skip the build step and serve existing content
# Examples:
./bssg.sh server --port 8080
./bssg.sh server --host 192.168.0.2
./bssg.sh server --no-build
You can run server --help for detailed information about all available options.
Example Workflow
# Create a new post
./bssg.sh post
# Start the development server to preview changes
./bssg.sh server
# In a different terminal, edit your post
./bssg.sh edit src/your-post.md
# Stop the server with Ctrl+C and restart with changes
./bssg.sh server
💡 Configuration Options
You can set default server host and port in your config.sh.local file:
BSSG_SERVER_PORT_DEFAULT=8080
BSSG_SERVER_HOST_DEFAULT="192.168.0.2" # Serve on specific local IP
Themes
Customize the look of your site with over 60 built-in themes
BSSG includes a wide variety of themes to customize the look of your site. Set your chosen theme in the config.sh.local file:
# Example config.sh.local entry
THEME="your-theme-name"
Or override it temporarily during build:
./bssg.sh build --theme minimal
You can also apply a custom CSS file on top of any theme by placing it in your static/ directory and setting CUSTOM_CSS in your config.
Theme Categories
Modern Themes
Clean, contemporary designs: default, minimal, dark, flat, glassmorphism, liquid-glass, material, art-deco, bauhaus, mid-century, swiss-design, nordic-clean, braun, and mondrian.
Retro Computing
Nostalgic themes inspired by classic computers: amiga500, apple2, atarist, c64, msdos, terminal, zxspectrum, nes, gameboy, tty, and mario.
OS-Inspired
Themes based on operating systems: beos, freebsd, macclassic, macos9, netbsd, nextstep, openbsd, osx, win311, win95, win7, and winxp.
Web Era Themes
Capture the aesthetic of different web eras: web1, web2, vaporwave, y2k, and bbs.
Content-Focused
Optimized for reading: docs, longform, reader-mode, mynotes, museum-label, field-journal, thoughtful, and text-only.
Special Themes
Unique designs: brutalist, newspaper, diary, microfiche, and random (selects a different theme each build).
Theme Preview Generator
Generate examples of all available themes with your content
BSSG includes a script to generate previews of all available themes. This helps you see how each theme looks with your content before deciding which one to use.
Generate Theme Previews
./generate_theme_previews.sh
This will create a directory called example/ containing subdirectories for each theme, along with an index.html file that allows you to navigate between them.
Custom Site URL
Set a custom base URL for the previews, useful if hosting the example gallery in a subdirectory.
./generate_theme_previews.sh --site-url "https://example.com/blog/example"
You can also point the preview generator at a site-specific config file:
./generate_theme_previews.sh --config /path/to/site/config.sh.local
BSSG configuration is resolved in this order:
- Command line argument (
--config) BSSG_LCONFenvironment variable- Local config file (
config.sh.local) - Main config file (
config.sh)
Performance Features
Built for efficiency even with large sites
Incremental Builds
Intelligently rebuilds only what changed, checking source files, templates, config, locale files, and theme files.
Caching System
Maintains caches for extracted metadata, rendered content, config state, and theme files to minimize redundant work. Automatic stale cache cleaning.
RAM Build Mode
Memory-first build mode that preloads sources, templates, and locales in memory and keeps build indexes in RAM. Skips cache persistence for faster full rebuilds. Stage timing summary printed at end.
Parallel Processing
Uses GNU parallel (if available) with automatic fallback to shell-worker background jobs. Auto-detects CPU cores; RAM mode caps workers via RAM_MODE_MAX_JOBS.
Asset Precompression
Incremental and parallel gzip precompression of .html, .css, .xml, and .js files. Configurable gzip level and verbosity.
File Locking
Basic file locking for safer concurrent operations when multiple processes access cache files during parallel builds.
Absolute URL Generation
Automatically post-processes generated HTML, CSS, and XML files to ensure all internal links use the absolute SITE_URL defined in config.
Stale Cache Cleaning
Automatically removes cache entries for source files that have been deleted to keep the cache relevant.
📊 Real-World Result
On a single-core OpenBSD server with spinning disks, the maintainer observed build time dropping to about one third of the previous release when building with BUILD_MODE="ram".
Enable RAM Build Mode
Set it in your config or use a command-line flag:
# In config.sh.local
BUILD_MODE="ram"
# Or per-build:
./bssg.sh build --build-mode ram
Enable Parallel Processing
For the fastest builds, especially on multi-core systems, install GNU parallel:
# Debian/Ubuntu
sudo apt-get install parallel
# macOS (Homebrew)
brew install parallel
# FreeBSD
pkg install parallel
BSSG automatically detects and utilizes parallel if present, falling back gracefully otherwise.
Enable Asset Precompression
# In config.sh.local
PRECOMPRESS_ASSETS="true"
# Optional tuning:
# PRECOMPRESS_GZIP_LEVEL=9
# PRECOMPRESS_MAX_JOBS=0 # 0=auto based on CPU
# PRECOMPRESS_VERBOSE=false
Admin Interface
Manage your blog with a user-friendly interface
BSSG will include an admin interface for managing your blog with these planned features:
WYSIWYG Editor
Create and edit posts with a user-friendly Markdown editor.
Post Scheduling
Schedule posts for future publication with an easy-to-use calendar interface.
Statistics
View statistics about your blog including post count, tag usage, and more.
Get Involved
Join the community, contribute, and stay updated