← Writing
boxlang blogging open-source

boxlang-ssg grows up: a real module, live reload and a demo site

boxlang-ssg is now a BoxLang module you install once and run in any site folder. 1.0 adds a built-in preview server, folder-style URLs and real error reporting. 1.1 adds live reload, a new command, folder defaults, permalink patterns, taxonomies, excerpts, YAML and CSV data, and baseUrl support. Dark Sky Dispatch, a fictional astronomy club blog, uses every feature and doubles as a GitHub template to start your own site.

Last August I wrote about boxlang-ssg, a static site generator written in BoxLang. Back then it was a single file called ssg.bx that you dropped into your project and ran with boxlang ssg.bx build. It worked, but it was a weekend project and it showed. The output folder setting was ignored. Previewing a site meant running boxlang-miniserver with a router file. Errors were mostly swallowed, so a broken page just quietly didn't get written.

Today I'm releasing 1.0 and 1.1, back to back. 1.0 turns it into a proper BoxLang module and fixes the things I'd been putting up with. 1.1 adds the features I kept wanting when I sat down to build a real site with it. And so you don't have to take my word for any of it, there's a demo site that uses every feature, which I'll get to at the end.

Install it once, run it anywhere

boxlang-ssg is now a module, so you install it once and run it in any folder that holds a site, the way you would with Hugo or Jekyll:

install-bx-module boxlang-ssg bx-yaml bx-markdown bx-jsoup

install-bx-module only installs the modules you name, so the three the generator uses are listed too. If one of them is missing, build tells you the exact command to run. CommandBox users can box install boxlang-ssg instead, which does pull in the dependencies.

Then:

boxlang module:ssg init my-site
cd my-site
boxlang module:ssg serve

init copies a starter site into my-site/. serve builds it, serves it at http://localhost:8080/, and rebuilds whenever you save a file. You need BoxLang 1.19 or later.

What 1.0 fixed

Most of 1.0 is the kind of work nobody notices until it's missing.

  • A real preview server. serve uses a small web server built into the module, so there's no miniserver and no router file. It listens on 127.0.0.1 only and answers a missing page with your site's 404.html.
  • URLs that work on any host. posts/hello-world.md is now written to posts/hello-world/index.html with the URL /posts/hello-world/. No rewrite rules, no router. Drop _site/ on any static host and the links work.
  • Errors you can see. A page that fails to render isn't written, the failure is printed as file: message, and the build exits 2. Problems found before rendering, like bad front matter or two pages writing the same file, stop the build before anything is deleted.
  • More commands. init, serve, list and clean, plus --source, --drafts, --port and --verbose.
  • A pile of fixes. Pagination wrote one of its pages to /jokes/page/index.html/index.html. An explicit permalink on a post was ignored. Future-dated posts were published. Dates were formatted with CFML masks that don't work on plain BoxLang. All fixed.

What's new in 1.1

1.1 is where it went from "it builds my test site" to "I'd build a real site with this."

  • serve reloads the browser. Save a file, the site rebuilds, and the page you're looking at reloads on its own. That includes failed rebuilds, so fixing an error shows up too. build --watch does the rebuilding without the server.
  • new creates posts. boxlang module:ssg new My First Post writes posts/my-first-post.md with the title, type and today's date already in the front matter. Add --draft and it starts unpublished.
  • Folder defaults. A _defaults.yml in a folder supplies front matter for everything in it and below. Put type: post in posts/_defaults.yml and you never type it again.
  • Permalink patterns. "permalinks": { "post": "/:year/:month/:slug/" } in ssg-config.json and every post gets a dated URL without setting one.
  • Dates from file names. posts/2026-03-01-launch.md takes its date from its name when it doesn't set one.
  • Taxonomies. Tags were always built in. Now you can list any other front matter key, like categories, and get the same grouping for it, with a page per value if you want one.
  • Excerpts and previous/next. Every document gets prc.excerpt, from front matter, the content before <!--more-->, or its first paragraph. Posts get prc.previous and prc.next.
  • YAML and CSV data. _data/ used to be JSON only. A CSV file becomes an array of structs, one per row, which is handy for anything you'd keep in a spreadsheet.
  • A base URL. Set baseUrl and every generated link, feed entry and sitemap URL respects it, including sites served from a sub-path like GitHub Pages. relUrl() and absUrl() cover the links you write by hand.
  • Config in templates. Your own keys in ssg-config.json are readable as config, so the site title lives in one place.
  • Better render errors. An error names the file that actually failed and the line, and when it's a layout it tells you which page was being rendered:
_includes/page.bxm: while rendering about.md: The requested key [nope] was not located in any scope or it's undefined (line 1)

The starter site got an Atom feed and a sitemap along the way.

One change to watch for if you're coming from 1.0: a post named 2026-12-14-something.md with no date now takes its date from the file name, so if that date is in the future it's treated as a draft until then. 1.0 published it.

Dark Sky Dispatch

A list of features only goes so far. What I always want when I pick up a new tool is a real site I can open up and poke at, so I built one.

Dark Sky Dispatch
Dark Sky Dispatch

ssg-template is Dark Sky Dispatch, a blog for the Cinder Ridge Astronomy Club, "a small, stubborn astronomy club on the edge of the high desert." The club doesn't exist. Neither do Mara, Priya or Teo, or the night they counted 64 Perseids in two hours. But the site is complete, and it uses every feature in 1.1.

A few examples of what's in it:

Every post in posts/ gets its type, author and category from one file:

# posts/_defaults.yml
type: post
author: mara
categories: Club News

The blog index is four posts per page at /blog/, /blog/page/2/ and so on, from a few lines of front matter:

<!---
title: Blog
view: wide
permalink: /blog/
pagination:
  data: collections.post
  size: 4
  alias: posts
--->

Categories are a custom taxonomy, and one template makes a page for each:

<!---
view: wide
permalink: /categories/{{category}}/
pagination:
  alias: category
  data: collections.taxonomies.categories.terms
--->

The observing log is a CSV file the club could keep in a spreadsheet:

date,observer,target,instrument,seeing,notes
2026-08-12,priya,Perseid meteors,Naked eye,4,"64 meteors in two hours, 3 fireballs"

There's also a post written as a BoxLang template that reads a second CSV file, author pages built by paginating over a YAML file, a draft and a future-dated post that only show up with --drafts, an Atom feed with full content, a sitemap, a robots.txt written with fileExt, and a custom 404. The README has a table of every feature and the file it lives in, so you can go straight to the one you care about.

It's a GitHub template repository, so Use this template gives you a copy to make your own. Or just clone it and run it:

git clone https://github.com/robertz/ssg-template.git
cd ssg-template
boxlang module:ssg serve

Change baseUrl before you publish it anywhere. It's set to a placeholder so the feed and sitemap have absolute links.

Wrapping up

boxlang-ssg is MIT licensed and on GitHub and ForgeBox. The docs have been rewritten for 1.1 and cover every command, key and template variable. If you build something with it, or it does something you didn't expect, I'd like to hear about it.

No comments yet — be the first.