Fabricate is a Clojure library for generating static websites that is simple, versatile, and under your control.

Simple

Fabricate's API provides 3 clear steps to build a website.

(->> {}
api/plan!
api/assemble
api/construct!)

Versatile

You can easily extend Fabricate's build process to new sources of data and new ways of building pages.

(defmethod api/build
[:markdown :hiccup]
[entry options]
(md-to-hiccup entry
options)
)

Under your control

Fabricate lets you augment your writing with Clojure: you can evaluate code within a page.

^{:kindly/kind :kind/hiccup}
[:h1 (:title metadata)]

Fabricate is built on the idea that you should be able to use Clojure to generate as much (or little) of your website as is necessary. Building a website in Fabricate means writing a Clojure program.

Examples


(let [s "output"]
(list [:hr]
[:strong (format "a form evaluated and displayed with its %s" s)])
)

a form evaluated and displayed with its output

Fabricate gives you a template that allows you to mix regular text and Clojure expressions. Hiccup forms returned by those expressions become HTML elements when Fabricate generates the page.

Fabricate also gives you an API that can generate a website using 3 core functions.

A simple API

(-> {}
api/plan!
api/assemble
api/construct!)

This API, while straightforward enough to quickly get started with, does not constrain what you can do with Fabricate. You can extend Fabricate to new markup formats or other methods of generating pages. If you use Clerk for some things and markdown for others, Fabricate can flexibly accommodate all of them with a unified API.

Simple things should be simple. Complex things should be possible.
Alan Kay
(require '[my-generation-code :refer [generate]])

(defmethod api/build [:my/format :hiccup]
[entry options]
(generate entry))


Documentation


Tutorials

These guides will get you up and running with Fabricate, so you can use it as a writing and creative tool. Hopefully you find them useful.

Tutorial 1: Using Fabricate to add documentation to an existing Clojure project

This first tutorial allows you to use Fabricate to document a project or library you've built.

Tutorial 2: Using Fabricate to create a website

🏗️ To be published.

In the second tutorial, you will learn how to publish all the pages you create using Fabricate as a website.

How-to guides


Supporting Fabricate in Emacs

Consult this guide to add support for Fabricate's templates to Emacs.

Further guides (to be published 🏗.)

Reference

Background Information

Namespaces


The namespace descriptions, automatically generated from the namespace forms, introduce the functionality that fabricate assembles to create pages.