« Home

Configuration [guide-0009]

The configuration is a Racket module site.rkt that (provide site) a hash. By default tr reads site.rkt; some commands let you point at a different file (read the CLI --help result to learn).

#lang racket/base
(require scribble/html)
(provide site)

(define site
  (hash 'domain "your domain"
        'title "your site title"
        'description "your site description"
        'head (list)))

Because the config is code, values can be computed and shared. For example a release config can reuse the dev one and override only the environment-specific keys, so identity such as head stays in one place:

#lang racket/base
(require (only-in "site.rkt" [site dev-site]))
(provide site)

(define site
  (hash-set* dev-site
             'mode "release"
             'output-path "_release"))

Optional options are

  1. 'output-path, default value is "_build", where tr build command produces files for publish. You can run

    python3 -m http.server -d _build

    to view result, or upload it to host.

  2. 'mode, default value is "release". When the value of 'mode is "dev", TR produces sourcemap.json in the output path, that enables Meta/Ctrl + E to edit the current page.

  3. 'head, a list of scribble HTML elements injected into the of every page. Use it for identity and metadata links, e.g.

    'head (list
            (link 'rel: "me" 'href: "https://mastodon.social/@you")
            (meta 'name: "fediverse:creator" 'content: "@you@mastodon.social")
            (link 'rel: "webmention" 'href: "https://webmention.io/you/webmention"))

    The rel="me" link lets a fediverse profile verify your site; the fediverse:creator meta attributes shared links to you.