Data-driven pages
For repeatable reference pages, use the data-driven pattern: put structured facts in data/, write one layout or shortcode that knows how to render them, and keep the Markdown page focused on context.
data/
├── contact.yml
├── publications.yml
└── talks.ymlThat keeps the site easier to maintain. The data file can be sorted, reviewed, generated, or partially refreshed by a script. The layout can improve the visual presentation without touching every item. The Markdown content can explain why the page exists without becoming a giant hand-maintained table.
Boundary#
The useful boundary is simple:
- Data files hold stable facts and curated fields.
- Layouts and shortcodes hold presentation rules.
- Scripts update only fields that have a trustworthy upstream source.
- Markdown pages own title, description, date, related links, and surrounding editorial context.
Display values#
Keep source data as data. When a value needs display formatting, use the smallest shared formatter that owns the rule: a shortcode, partial or template helper. Do not hard-code a rendered count, date, label or other derived display value in Markdown.
For example, content-count calculates and formats a Hugo or data-file count at render time. The Markdown page states what to count; the shortcode owns the display format.
Use this pattern when the page itself is the artifact. A glossary page, publication list, changelog, token category table, or reference table can be data-driven without needing a separate URL for every item.
Current inventory#
| Page | Data | Layout or renderer | Refresh |
|---|---|---|---|
| Emojis | data/series/ref/emojis.yml | layouts/references/emojis.html | npm run emoji |
| Blogroll | data/blogroll.yml, data/github-following.yml | layouts/blog/blogroll.html | npm run blogroll |
| Links | data/links.yml | layouts/links/list.html, layouts/links/single.html | npm run links, npm run links:import-stars |
| Books | data/books.yml | layouts/books/list.html, layouts/books/single.html, layouts/books/shelf.html | npm run books, npm run books:enrich |
| Projects | data/projects.yml | layouts/resources/projects.html | Manual |
| Publications | data/publications.yml | layouts/publications/publications.html | Manual |
| OPML | data/rss.opml.xml | layouts/blog/opml.html | Manual export |
| Main glossary | data/series/ref/glossary.yml | layouts/references/glossary.html | Manual |
| Brand glossary | data/brand/glossary.yml | layouts/shortcodes/glossary-table.html | Manual |
| Quotes | data/series/ref/quotes.yml | layouts/references/quotes.html | Manual |
| Country codes | data/series/ref/country-codes.yml | layouts/references/country-codes.html | Manual |
| Brand system changelog | data/brand/changelog.yml | layouts/shortcodes/brand-changelog.html | Manual |
| Token categories | data/brand/tokens.yml | layouts/shortcodes/token-table.html | npm run tokens:update |
Some datasets carry update rules of their own: emoji data is refreshed only from trusted upstream files, each link page pairs with a dicai.re short URL, and the blogroll includes a snapshot of the GitHub following list.
Data files must stay readable by hand. If the generated output becomes impossible to review, the automation is helping the machine more than the site.