« Home

Break. Config as code: site.json becomes site.rkt [config-as-code]

tr's configuration is no longer a JSON file. It is now a Racket Racket\color{#9F1D20}\text{Rac}\color{#3E5BA9}\text{ket} module site.rkt that (provide site) a hash. See Configuration for the current format.

Why [local-0]

JSON could not describe what goes into a page's without an ever-growing list of special-case keys, for example, the old "fedi" option. With the config as code you write scribble HTML elements directly, and you can compute and share values: for example a release config that reuses the dev one and overrides only mode and output-path.

What changed [local-1]

  1. Configuration is site.rkt, a module exporting a site hash.
  2. The "fedi" option is removed. Inject identity and metadata links through the generic head list instead (rel="me", fediverse:creator, webmention, …).
  3. raco tr init now scaffolds site.rkt.

How to migrate [local-2]

Run a build. When tr sees a leftover site.json it generates the equivalent site.rkt for you, it will upgrade option "fedi" into the matching head elements, then asks you to delete the JSON. Then you:

  1. Delete site.json.
  2. Point any --config xxx.json at xxx.rkt (e.g. In your Makefile\color{#a0522d}\text{Makefile}).

This conversion is a temporary convenience and may be removed in a future release, so migrate rather than relying on it.