Skip to content

v0.3.0 — the language block, and site-supplied parameters

Choose a tag to compare

@robertblust robertblust released this 31 Aug 11:59
· 48 commits to main since this release

A fourth block, and the package's first parameter that comes from your site rather than from
the package.

The block

The 37 lines that carry a reader's chosen language across all three domains — click German on one
site, follow a link to another, arrive in German. It is on all 20 pages and until now had no
fence, no version and nothing checking it
, which is exactly how it drifted into two dialects.

design:check will go red in all three sites until each adds one line of config and runs
npm run design.

The new thing: langKey

Every substitution so far came from the package — {{variant}} is chosen from a set the package
owns. This one does not. Each site declares its own storage key:

// design.config.json
{ "groups": ["fonts", "stage"], "langKey": "rb-lang" }

It cannot be derived: blust.ch stores under rb-lang, and nothing about the domain yields
that. And it is not a value to compute even if it could be — changing a storage key silently
discards every visitor's saved language.
It is a constant with a migration cost, so it lives
where changing it is a visible act.

A fenced page whose site declares no key is an error — exit 2, not a default. An empty key
would throw nowhere and would quietly give every visitor of that site the same nameless slot.

FAMILY is not a parameter, on purpose

The regex naming the three domains was hardcoded in 23 places — all 20 pages plus the
carriesLang check in three suites. It is now lib/family.mjs, importable as
@robertblust/design/family, and substituted into the block. Adding a fourth site becomes one
edit instead of twenty-three.

It is a constant, not a parameter, and the distinction is the point: a parameter is for what a
site is entitled to choose, not for what merely happens to be shared.

Adopting

npm install --save-dev "github:robertblust/design#v0.3.0"
# add "langKey" to design.config.json
npm run design && npm run og

The sync rewrites fence content only — no behaviour changes, and your storage key stays exactly
what it was.