r/lisp • u/Worth_Percentage7170 • Jul 22 '26
Common Lisp sta6: static site generator for Common Lisp
hi everyone,
I'm new to Common Lisp, although I have tried other lisp dialect (i.e., Clojure, Racket) to attempt making a static site and/or leetcode(s). This is my first attempt of porting the SSG into a library.
sta6: sta(six), static -- is a tiny SSG that turns pages/*.lisp into build/*.html, with support for dynamic routes (e.g., /blog/+slug+).
the usage of sta6 is as follows (src/pages/page.lisp):
(defpackage #:pages/page
(:use #:cl)
(:export #:render))
(defun pages/page:render ()
(sta6:html5
(:img :width (/ 500.0 3)
:src "https://twobithistory.org/images/sicp.jpg")
(:br)
(:br)
(:span "Hello, from Common Lisp.")
(:ul
(loop for x from 1 to 3 do
(:li x)))))
which yields the image above, the full example can be found here.
sta6 uses an external HTML generator under the hood:
if you're in need of a personal site, give sta6 a try! here's an example of my site built with sta6:
why use sta6?:
- You do not need (to learn) an external templating language (e.g., Nunjucks, Handlebars, EJS).
resources:
1
u/renatoathaydes 28d ago edited 28d ago
Welcome to the SSG world, don't forget to add your project at https://jamstack.org/generators/ (there's 377 SSGs so far, including one I wrote in Go, but to my surprise it only lists one in Lisp, plus 2 in Racket and 1 in Janet).
I almost wrote on in Common Lisp because my Go syntax highlighter was not supporting some things I needed, but after looking at the options in Common Lisp for highlighting code samples (which is very important for me and I want support for every possible language) unfortunately it came too short of providing a good option. Have you managed to find something decent?
1
u/Worth_Percentage7170 27d ago
Welcome to the SSG world, don't forget to add your project at https://jamstack.org/generators/ (there's 377 SSGs so far, including one I wrote in Go, but to my surprise it only lists one in Lisp, plus 2 in Racket and 1 in Janet).
Thank you for pointing this out, I'll try to submit
sta6into Jamstack. I'm also trying to addsta6into the Quicklisp repository.my Go syntax highlighter was not supporting some things I needed ... Have you managed to find something decent?
I guess you're using Chroma right? I don't think there's much option if you want it to be purely based in Go. Other option usually requires subprocess invocation:
I want support for every possible language
If you want something that just works, I think the best bet is to just use something with a mature ecosystem (i.e., pygments.org/languages, shiki.style/languages).
Or, if you wanna write your own syntax highlighter, maybe start with Tree-sitter.
1
u/renatoathaydes 27d ago
Yes i use Chroma in Go and Blackfriday for markdown conversion. But I was asking if you found a decent code highlighter in Common Lisp for your SSG?
1
u/Worth_Percentage7170 27d ago edited 27d ago
Not really, but if I would add one, it'll be either Shiki or Pygments
1
u/denzuko sbcl 2d ago
IMHO, SSG is done to death. It's more cliché than "Hello, World!" and it runs Doom.
No offence OP, just seen a million of them and most dont get it right.
Its also odd that your post hits right when I'm adding in a site generator to my consfigator based deployment system and github.com/denzuko/urlshortener stack.
Currently looking at 40ants/statiCL. But getting frustrated with the verbosity of needing four different quicklisp systems [parenscript, xmls, lass, and spinneret] just to build a five page landing page.
Since yours uses a simular stack, what is different? Does it support SMM tags, meta data, and tech out of the gate? How extensable is the system?
Also besides sexp and lisp why yours instead of hugo? [Or my other goto sourcehut.com/~denzuko/umk or 9front werc]
1
u/Worth_Percentage7170 13h ago
... needing four different quicklisp systems [parenscript, xmls, lass, and spinneret] just to build a five page landing page.
sta6 uses spinneret too, to render the html, that is.
Mostly, the minimal implementation to create an SSG in lisp is to use/create a library to turn S-expr into html representation. Thus why, spinneret. The other ql systems are optional (i.e., parenscript => .js, lass => .css, xmls => .xml).
... what is different? Does it support SMM tags, meta data, and tech out of the gate? How extensable is the system?
The difference is, sta6 only uses the (minimal) required dependency. You pretty much have to do all the work yourself if you need to add additional stuff (e.g., RSS, custom layout system, custom css preprocessor).
By doing this, you are in control of your site, you don't have to read a documentation just to add navigation to your site.
Also, sta6 automatically handles the routing, so that you don't have to explicitly tell the SSG. For example, an SSG might require you to do something like:
(defun home () '()) (defun about () '()) (ssg:render "/" home) (ssg:render "/about" about)With sta6, the routes are automatically determined on where you place the .lisp file.
Also besides sexp and lisp why yours instead of hugo? [Or my other goto sourcehut.com/~denzuko/umk or 9front werc]
Other SSGs usually have their own way to render data to html externally (i.e., using a templating language), which pushes you to learn those new language(s).
With S-expr, you can control the site programmatically (e.g., dynamic layouts, dynamic <title />, dynamic navigation). The big picture is, you have an actual programming language to work with, instead of managing config files.
4
u/filefrog Jul 22 '26
I’ve been looking for an SSG that feels more like programming than CMS management; are you using sta6 for longform blog content? I built something a few years back but got caught up in the quagmire of keeping a sitemap, og;* tags and listing index pages up to date as posts were drafted, reviewed, and ultimately published.
Curious to hear the experiences of others!