html-is-a-tree
glfmn.io·22h·
Flag this post

Name

html-is-a-tree

I use a static site generator to build this site, but I keep hitting its limitations.

Introduction

A long while ago, I used clojure for some web development and used hiccup-style html templates for the first time. For the uninitiated, clojure is a lisp dialect. This makes it possible directly represent tree structures. For example, here is an HTML document:

[:html
[:head
[:link { :rel "stylesheet" :href "/style.css" }]]
[:body
[:article
[:h1 "Hello world!"]
[:p "This clojure data structure directly encodes an HTML document."]]]]

One can do more than just write static documents this way, as it becomes very easy to directly inject new structure using code:

(let [posts (load-documents "posts/**/*.md")]
[:html
[:head
[:link ...

Similar Posts

Loading similar posts...