Skip to content

Content Tokens

Content tokens are shared values — like the project tagline — defined once and reused across the site so they can't drift out of sync. The source of truth is a single plain-YAML file, src/content/tokens/tokens.yaml, read in code via getToken("id") (see src/config/tokens.ts).

This is the actual contents of tokens.yaml, read from the real file at build time (so it can never drift from what's shown here). It's rendered via a Markdoc tag — the Keystatic-safe, import-free way to embed live source:

src/content/tokens/tokens.yaml
# Content tokens — shared values defined once and reused across the site so they
# stay in sync. Each top-level key is a token id; `value` is what renders and
# `description` explains where/why it is used. Read in code via getEntry("tokens", "<id>")
# (see src/config/tokens.ts) and shown live on the Content Tokens page (src/content/docs/tokens.mdoc).
#
# This is a plain YAML data file (an Astro "data" content collection via the
# file() loader) so it round-trips through Keystatic and contains no ESM/JSX/MDX.
# To add a token: add a new key below with `value` and `description`, then read it
# in code with getEntry("tokens", "your-key").
tagline:
value: Rebuilding Drupal's community Groups platform on Modern Drupal.
description: One-line project tagline. Shown in the homepage hero and the site footer.

The title bar above shows the file's location in the repo. Everything you need is in that file — each token's value and a description of where it's used — so this page shows the real thing rather than a copy that could fall out of date.

  1. Add a new top-level key to src/content/tokens/tokens.yaml with a value (what renders) and a description (where and why it's used).
  2. Read it in .astro code with getToken("your-key") from src/config/tokens.ts, or use getEntry("tokens", "your-key") directly.
  3. Rebuild — the YAML block above shows it automatically, and an unknown key fails the build loudly.