Most of Munchable's single-question pages are generated from the keys of a data map: one ingredient in, one page out. The coeliac pages could not be built that way, and the reason is a nice small lesson about where generated sites break.
Coeliac disease is about gluten, and gluten on a label rarely arrives as the word gluten. It arrives as the name of a grain in the shape it was milled, baked or brewed. So the pages for it are built from a hand-written list of label words, the names a shopper actually reads, and each word is a promise: "there is a page that answers this".
You can see the result on the hidden gluten reference page, which is the list form, and on the coeliac guide that the single-word pages hang from. I will not walk through what any word is graded as. This post is about what keeps the promise.
Why a promise can break without a sound
A word in that list passes through several steps before it becomes a URL:
- it is turned into a canonical taxonomy id, the same way a label is read
- the id has to be a real id in the taxonomy
- the id has to reach an entry in the gluten vocabulary
- the id has to exist in the ingredient index, with a slug
- the page for that slug has to answer something other than "unknown"
Every one of those can fail without raising an error. A typo in the list produces an id that is not in the taxonomy, and the page is simply not generated. A renamed id in the vocabulary means the word no longer reaches an entry. A slug that moves changes a published URL. Each failure looks the same from outside: the build passes, the sitemap is a little shorter, and nobody notices.
This is the specific hazard of a generated site. The compiler checks that the code is valid. It does not check that the set of pages is the set you meant.
One test per link in the chain
The test file mirrors the steps above. The first two are the same shape: map over the words, collect the failures, and assert the failures are an empty array. Collecting rather than asserting inside the loop is deliberate, because one failing run then names every broken word, not just the first.
it('every promised label word is a real taxonomy id', () => { const failures = COELIAC_LABEL_WORDS .map((word) => canonicalizeTag(`en:${word}`)) .filter((id) => !isKnownTag(id)); assert.deepEqual(failures, []); }); The third test loops instead, and builds strings that explain each failure. Each one names the word, the id it became and the step that failed, such as the id not being in the ingredient index, having no answer page, or answering unknown. A test that fails with a list of readable sentences is a test you can act on in one read.
Aliases collapse onto one page
The words go through the same canonicalisation as a label, so an alias such as a regional name for a grain lands on the id its page is built from. The result is one page per thing, not a second page that says the same thing under a different name. Duplicate content is the quiet cost of a list written by a person who knows too many words for the same grain.
A question that answers itself gets no page
A handful of ids are phrased so the question contains its own answer. A page called something like "is gluten free oats gluten free" is the one kind of thin content that also looks like a trick, so those ids are excluded from page generation on purpose, and a test asserts that five specific slugs are not published. The shopper's real question is a different one, and it has a proper page.
The point of testing an exclusion is that exclusions are decisions. Without the test, the next person to tidy the list sees an id with no page and helpfully adds one.
The slug is a URL, the name is for people
One test pins a single ingredient: its display name keeps the apostrophe, and its slug does not follow the name. The slug is a published URL, so it is derived once and then treated as a contract. It is the same discipline as a database primary key: a human-friendly label can change, an identifier cannot.
The never-promise is read, not retyped
The reference page carries a standing statement that Munchable never reports a product as gluten free: it reads the listed ingredients and any claim on the pack. That sentence is not typed on the page. It is read off a real result from the same function the app calls, so the page and the app cannot drift into promising different things.
The same instinct shows up in the page's metadata. The title and description are written as literals in the route file rather than pulled from a constant, because an SEO test reads those literals out of the source to check them against what a search result can display, and a constant is invisible to it. A small awkwardness in the code buys a check that cannot be bypassed by refactoring.
The pattern
If your pages come from a list somebody curated, test the list as a promise, one assertion per transformation, and print failures as sentences. If a page is deliberately absent, test the absence. And if a sentence on the page is a claim about the product, derive it from the product.
For a look at what a few hundred of these pages add up to, the answers index lists every one.