Cedwyn library

Front ends

Serverless static pages: layout in the section, data from the database.

Serverless and static

Every page a visitor opens is a static file from Cloudflare Pages. There is no application server. Interactive parts run in the browser: search, filters, maps, the read-more control, glossary pop-ups and database queries.

Reading data from the database

A page loads /_cedwyn/cat.js and asks the core catalogue directly:

<script src="/_cedwyn/cat.js"></script>
<script>
Cedwyn.db().then(db => db.query(
  "SELECT a.title, l.path FROM locations l JOIN artifacts a ON a.id = l.aid WHERE l.theme = ? AND a.kind = 'page' LIMIT 20",
  ['wayback'])).then(rows => render(rows));
</script>

The browser fetches only the 256 KB chunk files the query touches. The same data is available through GraphQL (Cedwyn.graphql(query, variables)), and stored images and documents come back as data: URIs.

Layout in the section, words in the data

The target for every section: its branch holds templates, styles and scripts; its words and records come from data. Today this holds for the parts generated from data at build time:

Front endData source
Header and section selectorthemes.json (order, titles in English, Welsh and Spanish, groups)
Landing tiles, Wales and Argentina hubssections.json, data/halves.json
Glossary and name-variant pop-upsdata/glossary.json, data/nomenclature.json
Title chaindata/title-chain.json
E-book editions and pricesdata/ebooks.json
1000 Cutsa layer in the core catalogue
Catalogue and GraphQL pagesthe core catalogue, live in the browser
The Garden Gallery (/nft-art/)its own section.sqlite, read from section_records at run time; every word included
This librarycontent/pages.json and data/sections.json on branch library

Most other sections are complete static sites whose words still sit in their HTML. Status lists them and the order in which they move to data.

Shared runtime

  • /_cedwyn/runtime.js: keeps every link and form inside the site; maps old subdomain paths at run time.
  • /_cedwyn/ghf/: the shared header, language switch (English, Welsh, Spanish) and section selector.
  • /_cedwyn/clamp.js: text blocks show three lines with a read-more control.
  • /_cedwyn/wiki.js: glossary links and name-variant pop-ups.
  • /cedwyn-sw.js: service worker that serves files from the database chunks.

Human pages and agent small print

Human pages carry the record only. Notes for software agents are kept out of view: in <meta> and <link rel="alternate"> tags, in elements marked hidden data-for-agents, and in /agents.json, /llms.txt and /academy/. The build pass tools/quiet_pages.py moves any note that describes the page, the site, its data sources or its agents into that small print, without changing its words, and lists each one in /_cedwyn/reports/quiet_pages.json.