From beb7c0953f2778c325bc62cca913e9320d7a84ad Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Mon, 28 Sep 2026 12:33:19 -0700 Subject: [PATCH 1/3] Add an Afrikaans Family Page Chosen by the Browser's Language Caddy sends a browser whose first language is Afrikaans from / to /af/, while /en/ and /af/ hold a visitor's own choice. Both pages share the styles and tree script, now in site.css and site.js, which lets the family CSP drop unsafe-inline for scripts. Co-Authored-By: Claude Opus 5.5 --- OPERATIONS.md | 2 +- deploy/Caddyfile | 13 +- sites/viljoen.family/README.md | 22 +- sites/viljoen.family/af/index.html | 183 +++++++++++++ sites/viljoen.family/index.html | 424 +---------------------------- sites/viljoen.family/site.css | 281 +++++++++++++++++++ sites/viljoen.family/site.js | 141 ++++++++++ 7 files changed, 645 insertions(+), 421 deletions(-) create mode 100644 sites/viljoen.family/af/index.html create mode 100644 sites/viljoen.family/site.css create mode 100644 sites/viljoen.family/site.js diff --git a/OPERATIONS.md b/OPERATIONS.md index ab970f55..e95244dc 100644 --- a/OPERATIONS.md +++ b/OPERATIONS.md @@ -439,7 +439,7 @@ The maps are generated by [`capture/build-redirects.py`](./capture/build-redirec The bundle also carries `viljoen.family`, a single static page whose source is [`sites/viljoen.family/`](./sites/viljoen.family/). `make-release.sh` copies it to `family/` beside `site/`, leaving out its README, and precompresses it the same way. It shares the release, the containers, and the rollback with the blog, so a family change ships as a blog release. -A second site block in `deploy/Caddyfile` serves it on the same port, selected by the `Host` header the proxy forwards. Any other hostname falls through to the blog's `:8080` block, so the blog's redirects never answer on the family host. The family block carries its own security headers and CSP, and answers a missing path with the page itself at a `404` status. +A second site block in `deploy/Caddyfile` serves it on the same port, selected by the `Host` header the proxy forwards. Any other hostname falls through to the blog's `:8080` block, so the blog's redirects never answer on the family host. The family block carries its own security headers and CSP, and answers a missing path with the page itself at a `404` status. It also routes the page's two languages: `/` redirects to `/af/` for a browser whose first language is Afrikaans, while `/en/` and `/af/` never redirect. **A rollback to a release older than the family block drops it.** Every hostname then reaches the blog block, so `viljoen.family` serves the blog, indexable on production, until a release carrying the block is live again. diff --git a/deploy/Caddyfile b/deploy/Caddyfile index 5ce5b795..03da1139 100644 --- a/deploy/Caddyfile +++ b/deploy/Caddyfile @@ -137,12 +137,23 @@ http://viljoen.family:8080, http://viljoen.vps.insanegenius.net:8080 { Strict-Transport-Security "max-age=31536000" X-Content-Type-Options "nosniff" Referrer-Policy "strict-origin-when-cross-origin" - Content-Security-Policy "default-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src https://fonts.gstatic.com; connect-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com; script-src 'self' 'unsafe-inline'; img-src 'self' data:" + Content-Security-Policy "default-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src https://fonts.gstatic.com; connect-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com; script-src 'self'; img-src 'self' data:" } @svg path *.svg header @svg Cache-Control "public, max-age=604800" + # The root follows the browser's first language, and /en/ and /af/ never redirect, so the language switch always holds. + @af_first { + path / + header_regexp Accept-Language `^\s*af(-[A-Za-z0-9]+)?\s*(;|,|$)` + } + header / Vary Accept-Language + redir @af_first /af/ 302 + redir /en /en/ 308 + redir /af /af/ 308 + rewrite /en/ /index.html + file_server { precompressed br gzip } diff --git a/sites/viljoen.family/README.md b/sites/viljoen.family/README.md index d5823a7c..37f400b1 100644 --- a/sites/viljoen.family/README.md +++ b/sites/viljoen.family/README.md @@ -10,6 +10,7 @@ The single-page genealogy site for the Viljoen family, served at `viljoen.family - [Page Design](#page-design) - [How the Tree Is Drawn](#how-the-tree-is-drawn) - [Facts on the Page and Their Sources](#facts-on-the-page-and-their-sources) +- [Languages](#languages) - [Local Preview](#local-preview) - [Ideas Not Yet Done](#ideas-not-yet-done) @@ -17,7 +18,10 @@ The single-page genealogy site for the Viljoen family, served at `viljoen.family | File | What it is | | --- | --- | -| `index.html` | The whole page, with inline CSS and the inline tree-drawing script | +| `index.html` | The English page, served at `/` and `/en/` | +| `af/index.html` | The Afrikaans page, served at `/af/` | +| `site.css` | The styles both pages share | +| `site.js` | The tree-drawing script both pages share | | `crest.svg` | The full achievement (crest, helm, mantling, shield, name scroll), viewBox 336x418 | | `favicon.svg` | The shield alone, cut from `crest.svg` | | `apple-touch-icon.png` | 180x180, `favicon.svg` on parchment | @@ -50,7 +54,7 @@ The arms derive from the French family Villon de Varennes, whose crest was a gol - **Frame:** a 2.5px red border plus an inner 1px gold rule (`.frame::before`) with rounded corners and four gold corner flourishes (`#corner` symbol). A negative margin on the masthead equals the frame's top margin (128px, or 96px on phones). That puts the top border behind the mantling, so change both values together. - **Paper texture:** an inline SVG `feTurbulence` noise data URI plus a radial vignette on `html`. - **Divider:** a simplified Huguenot cross (a Maltese cross with fleur points, balls on the tips, and a hanging dove), the `#huguenot-cross` symbol. -- **CSP:** the policy in `deploy/Caddyfile` allows `'unsafe-inline'` for scripts and styles because both are inline. Moving them to `site.css` and `site.js` lets the policy drop it. Test in a browser after any CSP change, because a blocked script fails silently and the tree simply does not draw. +- **CSP:** the policy in `deploy/Caddyfile` allows only `'self'` for scripts, since the one script is `site.js`. Styles keep `'unsafe-inline'` for the `style` attributes and the ` + @@ -305,6 +41,8 @@

Viljoen

+ +
Stamouers @@ -440,148 +178,6 @@

Further readingVerdere leesstof

- + diff --git a/sites/viljoen.family/site.css b/sites/viljoen.family/site.css new file mode 100644 index 00000000..eaa4f431 --- /dev/null +++ b/sites/viljoen.family/site.css @@ -0,0 +1,281 @@ +:root { + --paper: #f4ead3; + --paper-card: #fbf5e4; + --ink: #2e2217; + --ink-soft: #5e4c39; + --red: #9e1b22; + --red-deep: #6e1016; + --gold: #b8862b; + --gold-light: #e2b34a; + --bark: #5b3f27; + --bark-dark: #3a2716; + --leaf: #6f7d3a; + --leaf-dark: #4f5a26; + --paper-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); +} +* { box-sizing: border-box; } +html { + background: var(--paper-tex), radial-gradient(ellipse at 50% 30%, #f7efdc 0%, var(--paper) 55%, #e6d5ae 100%) fixed; + background-color: var(--paper); +} +body { + margin: 0; + padding: 0 clamp(10px, 3vw, 28px) 28px; + color: var(--ink); + font: 400 1.125rem/1.6 "EB Garamond", Garamond, "Times New Roman", serif; +} +a { color: var(--red); text-decoration-color: color-mix(in srgb, var(--red) 40%, transparent); text-underline-offset: 3px; } +a:hover { text-decoration-color: currentColor; } + +/* ---------- Page frame: double rule, rounded, hung from the crest ---------- */ +.frame { + position: relative; + max-width: 1180px; + margin: 128px auto 0; + padding: 0 clamp(18px, 4vw, 60px) 40px; + border: 2.5px solid var(--red); + border-radius: 40px; +} +.frame::before { + content: ""; + position: absolute; + inset: 7px; + border: 1px solid var(--gold); + border-radius: 33px; + pointer-events: none; +} +.corner { + position: absolute; + width: 46px; height: 46px; + color: var(--gold); + pointer-events: none; +} +.corner.tl { top: 18px; left: 18px; } +.corner.tr { top: 18px; right: 18px; transform: scaleX(-1); } +.corner.bl { bottom: 18px; left: 18px; transform: scaleY(-1); } +.corner.br { bottom: 18px; right: 18px; transform: scale(-1, -1); } + +/* ---------- Crest ---------- */ +.masthead { + position: relative; + margin: -128px auto 0; + width: min(340px, 78vw); + text-align: center; + z-index: 1; +} +.crest { display: block; width: 100%; height: auto; filter: drop-shadow(0 3px 4px rgba(60, 30, 10, .25)); } + +/* ---------- Family tree ---------- */ +.tree { position: relative; padding-top: 48px; } +.tree > svg.branches { + position: absolute; left: 0; top: 0; + overflow: visible; + pointer-events: none; +} +.jump { display: none; } +.stamboom, .gen-b { list-style: none; margin: 0; padding: 0; } +.gen-a { display: flex; flex-direction: column; } +.gen-a > .gen-b { order: 1; } +.gen-a > .couple { order: 2; } +.gen-a > .soil { order: 3; } +.couple, .child, .stub { position: relative; z-index: 1; } +.couple { + width: 100%; + max-width: 620px; + margin: 170px auto 0; + padding: 20px 28px 18px; + text-align: center; + background: var(--paper-card); + border: 1.5px solid var(--gold); + border-radius: 18px; + box-shadow: 0 0 0 5px var(--paper-card), 0 0 0 6px color-mix(in srgb, var(--gold) 55%, transparent), 0 8px 22px rgba(70, 40, 10, .14); +} +.eyebrow { + margin: 0 0 4px; + font: italic 500 1rem/1.3 "Cormorant Garamond", serif; + letter-spacing: .06em; + color: var(--ink-soft); +} +.couple h2 { + margin: 0; + font: 600 clamp(1.5rem, 3.6vw, 2rem)/1.15 "Cormorant Garamond", serif; + color: var(--red-deep); +} +.couple h2 .x { font-weight: 500; color: var(--gold); padding: 0 .15em; } +.couple h2 .nm { white-space: nowrap; } +.couple p.meta { margin: 8px 0 0; font-size: 1rem; color: var(--ink-soft); line-height: 1.45; } + +.soil { + display: flex; + justify-content: space-around; + align-items: flex-end; + height: 84px; + margin-top: 34px; + padding: 0 8% 12px; + border-radius: 50% 50% 18px 18px / 26px 26px 18px 18px; + background: linear-gradient(to bottom, color-mix(in srgb, var(--bark) 14%, transparent), color-mix(in srgb, var(--bark) 34%, transparent)); + font: italic 600 1.05rem/1.2 "Cormorant Garamond", serif; + letter-spacing: .08em; + color: var(--bark-dark); +} + +.gen-b { + display: grid; + grid-template-columns: repeat(6, minmax(0, 1fr)); + gap: 14px; + align-items: end; +} +.gen-b > li { display: flex; flex-direction: column; } +.gen-b > li > .child { order: 2; } +.gen-b > li > .stub { order: 1; } +.child { + padding: 14px 12px 12px; + text-align: center; + background: var(--paper-card); + border: 1px solid color-mix(in srgb, var(--gold) 70%, transparent); + border-radius: 12px; + box-shadow: 0 4px 12px rgba(70, 40, 10, .1); +} +.code { + display: inline-block; + margin-bottom: 2px; + font: italic 500 .85rem/1 "Cormorant Garamond", serif; + color: var(--gold); + letter-spacing: .05em; +} +.child h3 { margin: 0; font: 700 1.4rem/1.1 "Cormorant Garamond", serif; color: var(--ink); } +.child p { margin: 6px 0 0; font-size: .92rem; line-height: 1.35; color: var(--ink-soft); } +.child p.spouse { font-style: italic; } +.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } +abbr[title] { text-decoration: none; cursor: help; font-style: normal; font-weight: 500; color: var(--red-deep); } +.line .child { border: 1.5px solid var(--red); } +.line .child::after { + content: "Viljoen line"; + display: block; + margin: 8px auto 0; + width: max-content; + padding: 1px 10px 2px; + font: italic 500 .8rem/1.3 "Cormorant Garamond", serif; + color: var(--paper-card); + background: var(--red); + border-radius: 999px; +} +.stub { + align-self: center; + margin: 0 0 54px; + padding: 2px 12px 3px; + font: italic 500 .9rem/1.3 "Cormorant Garamond", serif; + color: var(--leaf-dark); + background: var(--paper-card); + border: 1px dashed var(--leaf); + border-radius: 999px; + text-align: center; + white-space: nowrap; +} +.legend, .tree-note { + max-width: 680px; + margin: 22px auto 0; + text-align: center; + color: var(--ink-soft); +} +.legend { font-size: 1rem; } +.legend > span { white-space: nowrap; padding: 0 .5em; } +.tree-note { margin-top: 10px; font-style: italic; font-size: 1rem; } + +/* ---------- Divider (Huguenot cross) ---------- */ +.divider { + display: flex; align-items: center; gap: 16px; + max-width: 520px; + margin: 52px auto 40px; + color: var(--gold); +} +.divider::before, .divider::after { + content: ""; flex: 1; height: 1px; + background: linear-gradient(to var(--dir, right), transparent, var(--gold)); +} +.divider::after { --dir: left; } +.divider svg { width: 46px; height: 58px; flex: none; } + +/* ---------- Story sections ---------- */ +.story { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: clamp(24px, 4vw, 48px); +} +.story h2 { + margin: 0 0 10px; + font: 600 1.7rem/1.1 "Cormorant Garamond", serif; + color: var(--red-deep); +} +.story h2 small { + display: block; + font: italic 500 1rem/1.4 "Cormorant Garamond", serif; + color: var(--gold); + letter-spacing: .04em; +} +.story p { margin: 0 0 12px; } +.blazon { + margin: 0 0 14px; + padding: 10px 14px; + border-left: 3px solid var(--gold); + background: color-mix(in srgb, var(--paper-card) 70%, transparent); + font-style: italic; +} +.links { list-style: none; margin: 0; padding: 0; } +.links li { padding: 7px 0; border-bottom: 1px dotted color-mix(in srgb, var(--gold) 60%, transparent); } +.links li:last-child { border-bottom: 0; } +.links span { display: block; font-size: .92rem; color: var(--ink-soft); line-height: 1.35; } + +footer { + margin-top: 44px; + text-align: center; + font: italic 500 1rem/1.5 "Cormorant Garamond", serif; + color: var(--ink-soft); +} + +@media (max-width: 1100px) { + .stub { padding: 2px 8px 3px; font-size: .8rem; } +} + +/* ---------- Narrow screens: the tree becomes a single descending line ---------- */ +@media (max-width: 900px) { + .jump { + display: block; + width: max-content; + margin: 0 auto 18px; + font: italic 500 1.05rem/1.3 "Cormorant Garamond", serif; + } + .gen-b, .gen-a > .couple, .soil { width: min(100%, 526px); margin-left: auto; margin-right: auto; } + .gen-b { grid-template-columns: 1fr; gap: 14px; padding-left: 46px; } + .gen-a > .couple { margin-top: 48px; } + .gen-b > li > .stub { order: 3; align-self: flex-start; margin: 6px 0 0; } + .child { text-align: left; padding: 12px 16px; } + .child h3 { display: inline; } + .child .code { margin-right: 6px; } + .line .child::after { margin: 8px 0 0; } + .story { grid-template-columns: 1fr; max-width: 640px; margin: 0 auto; } +} +@media (max-width: 520px) { + body { font-size: 1.0625rem; } + .frame { margin-top: 96px; border-radius: 26px; } + .frame::before { inset: 5px; border-radius: 21px; } + .masthead { margin-top: -96px; } + .corner { width: 30px; height: 30px; } + .corner.tl, .corner.tr { top: 12px; } .corner.bl, .corner.br { bottom: 12px; } + .corner.tl, .corner.bl { left: 12px; } .corner.tr, .corner.br { right: 12px; } + .tree { padding-top: 40px; } + .soil { padding: 0 4% 10px; font-size: .95rem; } + .couple { padding: 16px 16px 14px; } +} + +.lang { + position: absolute; + top: 22px; + right: 76px; + z-index: 2; + font: italic 500 1.05rem/1.3 "Cormorant Garamond", serif; +} +:lang(af) .line .child::after { content: "Viljoen-lyn"; } +@media (max-width: 520px) { + .lang { position: static; margin: 10px 0 0; text-align: center; font-size: .95rem; } +} diff --git a/sites/viljoen.family/site.js b/sites/viljoen.family/site.js new file mode 100644 index 00000000..b555060e --- /dev/null +++ b/sites/viljoen.family/site.js @@ -0,0 +1,141 @@ +// Branches are measured from the rendered cards, so any layout the CSS produces gets a matching tree. +// Stacked cards on narrow screens get a stem down the left gutter instead of a fan. +(function () { + const NS = "http://www.w3.org/2000/svg"; + const tree = document.querySelector(".tree"); + const svg = tree.querySelector("svg.branches"); + const couple = document.getElementById("couple"); + const soil = tree.querySelector(".soil"); + const items = [...tree.querySelectorAll(".gen-b > li")]; + + function box(el) { + const t = tree.getBoundingClientRect(), r = el.getBoundingClientRect(); + return { l: r.left - t.left, r: r.right - t.left, t: r.top - t.top, b: r.bottom - t.top, + cx: (r.left + r.right) / 2 - t.left, cy: (r.top + r.bottom) / 2 - t.top }; + } + + function bez(p, t) { + const u = 1 - t; + return [0, 1].map(i => u*u*u*p[0][i] + 3*u*u*t*p[1][i] + 3*u*t*t*p[2][i] + t*t*t*p[3][i]); + } + function tangent(p, t) { + const u = 1 - t; + return [0, 1].map(i => 3*u*u*(p[1][i]-p[0][i]) + 6*u*t*(p[2][i]-p[1][i]) + 3*t*t*(p[3][i]-p[2][i])); + } + + // A cubic Bezier drawn as a filled shape whose width tapers from w0 to w1. + function limb(p, w0, w1) { + const left = [], right = [], n = 36; + for (let i = 0; i <= n; i++) { + const t = i / n, [x, y] = bez(p, t); + let [dx, dy] = tangent(p, t); + const len = Math.hypot(dx, dy) || 1; + const w = (w0 + (w1 - w0) * t) / 2; + const nx = -dy / len * w, ny = dx / len * w; + left.push(`${(x + nx).toFixed(1)},${(y + ny).toFixed(1)}`); + right.push(`${(x - nx).toFixed(1)},${(y - ny).toFixed(1)}`); + } + const el = document.createElementNS(NS, "path"); + el.setAttribute("d", `M${left.join("L")}L${right.reverse().join("L")}Z`); + el.setAttribute("class", "limb"); + return el; + } + + // Leaves sprout from a limb at the given positions, alternating sides. + function leaves(p, ts, size, seed) { + const g = document.createElementNS(NS, "g"); + ts.forEach((t, i) => { + const [x, y] = bez(p, t), [dx, dy] = tangent(p, t); + const side = (i + seed) % 2 ? 1 : -1; + const ang = Math.atan2(dy, dx) * 180 / Math.PI + side * (50 + (i * 17 + seed * 11) % 25); + const s = size * (0.8 + ((i * 7 + seed * 5) % 5) / 10); + const leaf = document.createElementNS(NS, "path"); + leaf.setAttribute("d", `M0,0 C${s*.3},${-s*.32} ${s*.75},${-s*.3} ${s},0 C${s*.75},${s*.3} ${s*.3},${s*.32} 0,0Z M${s*.12},0 L${s*.85},0`); + leaf.setAttribute("transform", `translate(${x.toFixed(1)},${y.toFixed(1)}) rotate(${ang.toFixed(1)})`); + leaf.setAttribute("class", (i + seed) % 5 === 0 ? "leaf gold" : (i % 2 ? "leaf" : "leaf dark")); + g.appendChild(leaf); + }); + return g; + } + + function draw() { + const t = tree.getBoundingClientRect(); + svg.setAttribute("width", t.width); + svg.setAttribute("height", t.height); + svg.innerHTML = ` + + + + + + `; + + const cp = box(couple), so = box(soil); + const k = items.map(li => ({ c: box(li.querySelector(".child")), line: li.classList.contains("line"), + stub: li.querySelector(".stub") && box(li.querySelector(".stub")) })); + const stacked = k.length > 1 && k[1].c.t > k[0].c.b - 2; + + [-2, -1, 0, 1, 2, -1.5, 1.5].forEach((j, i) => { + const main = i < 5, sx = cp.cx + j * 22, sy = cp.b - 8; + const ex = cp.cx + j * (so.r - so.l) / (main ? 9 : 6), ey = so.t + (so.b - so.t) * (main ? .55 + (i % 2) * .25 : .4); + const p = [[sx, sy], [sx + j * 4, sy + (ey - sy) * .5], [ex - j * 10, ey - (ey - sy) * .3], [ex, ey]]; + const r = limb(p, main ? 11 - Math.abs(j) * 2 : 4, 1.2); + r.setAttribute("class", "limb root"); + svg.appendChild(r); + }); + + if (!stacked) { + const kb = Math.max(...k.map(x => x.c.b)), gap = cp.t - kb, forkY = cp.t - gap * .32; + const trunk = document.createElementNS(NS, "g"); + trunk.setAttribute("class", "trunk"); + const tp = [[cp.cx, cp.t + 8], [cp.cx + 6, cp.t - gap * .12], [cp.cx - 6, forkY + gap * .1], [cp.cx, forkY]]; + trunk.appendChild(limb(tp, 30, 24)); + svg.appendChild(trunk); + k.forEach((x, i) => { + const sx = cp.cx + (i - (k.length - 1) / 2) * 7, sy = forkY + 6; + const ex = x.c.cx, ey = x.c.b - 4, dy = sy - ey; + const p = [[sx, sy], [sx, sy - dy * .55], [ex, ey + dy * .6], [ex, ey]]; + svg.appendChild(limb(p, x.line ? 17 : 11, x.line ? 8 : 4)); + svg.appendChild(leaves(p, [.4, .55, .7, .84], 14, i)); + if (x.stub) { + const q = [[x.c.cx, x.c.t + 4], [x.c.cx, x.c.t - 20], [x.stub.cx, x.stub.b + 20], [x.stub.cx, x.stub.b - 2]]; + svg.appendChild(limb(q, 8, 4)); + svg.appendChild(leaves(q, [.35, .7], 12, i + 1)); + } + }); + } else { + const gx = k[0].c.l - 24, top = k[0].c.cy; + const trunk = document.createElementNS(NS, "g"); + trunk.setAttribute("class", "trunk"); + const tp = [[gx, cp.t + 10], [gx - 5, cp.t - (cp.t - top) * .35], [gx + 5, cp.t - (cp.t - top) * .7], [gx, top]]; + trunk.appendChild(limb(tp, 18, 7)); + svg.appendChild(trunk); + svg.appendChild(leaves(tp, [.15, .5], 14, 2)); + k.forEach((x, i) => { + const sy = x.c.cy + 16; + const p = [[gx, sy], [gx + 10, sy - 4], [x.c.l - 12, x.c.cy], [x.c.l + 2, x.c.cy]]; + svg.appendChild(limb(p, x.line ? 9 : 6, x.line ? 5 : 3)); + svg.appendChild(leaves(p, [.45], 11, i)); + }); + } + } + + let queued = false; + function schedule() { + if (queued) return; + queued = true; + requestAnimationFrame(() => { queued = false; draw(); }); + } + addEventListener("resize", schedule); + addEventListener("load", schedule); + if (document.fonts) document.fonts.ready.then(schedule); + if ("ResizeObserver" in window) new ResizeObserver(schedule).observe(tree); + schedule(); +})(); From 39f28766a3184052e8086c465fb124657e0f1db8 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Mon, 28 Sep 2026 12:39:24 -0700 Subject: [PATCH 2/3] Keep the Language Switch Clear of the Crest and Tighten the Routing The switch overlapped the crest between 521px and 640px. The language match now ignores case and an explicit q=0, the redirect keeps the query string, a stray /af/ path falls back to the Afrikaans page, and the shared CSS and JS revalidate on every load. Co-Authored-By: Claude Opus 5.5 --- deploy/Caddyfile | 21 ++++++++++++++++----- sites/viljoen.family/README.md | 2 +- sites/viljoen.family/af/index.html | 8 ++++---- sites/viljoen.family/index.html | 10 +++++----- sites/viljoen.family/site.css | 2 +- 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/deploy/Caddyfile b/deploy/Caddyfile index 03da1139..07161c8b 100644 --- a/deploy/Caddyfile +++ b/deploy/Caddyfile @@ -142,14 +142,16 @@ http://viljoen.family:8080, http://viljoen.vps.insanegenius.net:8080 { @svg path *.svg header @svg Cache-Control "public, max-age=604800" + @code path *.css *.js + header @code Cache-Control "no-cache" # The root follows the browser's first language, and /en/ and /af/ never redirect, so the language switch always holds. @af_first { path / - header_regexp Accept-Language `^\s*af(-[A-Za-z0-9]+)?\s*(;|,|$)` + header_regexp Accept-Language `(?i)^\s*af(-[a-z0-9]+)*\s*(,|$|;\s*q\s*=\s*(1|0?\.0*[1-9]))` } header / Vary Accept-Language - redir @af_first /af/ 302 + redir @af_first /af/{?query} 302 redir /en /en/ 308 redir /af /af/ 308 rewrite /en/ /index.html @@ -160,9 +162,18 @@ http://viljoen.family:8080, http://viljoen.vps.insanegenius.net:8080 { # A single-page site has nowhere better to send a stray path than the page itself. handle_errors { - rewrite * /index.html - file_server { - precompressed br gzip + @af_page path /af/* + handle @af_page { + rewrite * /af/index.html + file_server { + precompressed br gzip + } + } + handle { + rewrite * /index.html + file_server { + precompressed br gzip + } } } diff --git a/sites/viljoen.family/README.md b/sites/viljoen.family/README.md index 37f400b1..3c72a366 100644 --- a/sites/viljoen.family/README.md +++ b/sites/viljoen.family/README.md @@ -100,7 +100,7 @@ The page exists in English and Afrikaans, as two HTML files that share `site.css ## Local Preview -Serve the directory with any static server, for example `python3 -m http.server 8765 --bind 127.0.0.1 --directory sites/viljoen.family`. A phone viewport (375px) shows no horizontal overflow and no console errors. A static server serves `/af/` directly, but the language redirect and the CSP need Caddy. +Serve the directory with any static server, for example `python3 -m http.server 8765 --bind 127.0.0.1 --directory sites/viljoen.family`. A phone viewport (375px) shows no horizontal overflow and no console errors. A static server serves `/af/` directly. The language redirect, the `/en/` address the Afrikaans switch links to, and the CSP need Caddy. ## Ideas Not Yet Done diff --git a/sites/viljoen.family/af/index.html b/sites/viljoen.family/af/index.html index 13e93ef2..942534d2 100644 --- a/sites/viljoen.family/af/index.html +++ b/sites/viljoen.family/af/index.html @@ -37,7 +37,7 @@
Die Viljoen-familiewapen: 'n goue sint-andrieskruis op 'n rooi skild, onder 'n helm met 'n paar goue arendsvlerke in profiel as helmteken, met rooi en goue dekkleed en 'n banderol met die naam Viljoen + alt="Die Viljoen-familiewapen: 'n goue skuinskruis op 'n rooi skild, onder 'n helm met 'n paar goue arendsvlerke in profiel as helmteken, met rooi en goue helmkleed en 'n banderol met die naam Viljoen">

Viljoen

@@ -78,7 +78,7 @@

François Villion gedoop 19.05.1682 Kaapstad

getroud 1707 Margaretha de Savoye

-

c-geslag volg

+

c-geslag volg later

  • @@ -86,7 +86,7 @@

    François Villion gedoop 24.09.1684 Kaapstad

    getroud 14.08.1708 Catharina Snyman

    -

    c-geslag volg

    +

    c-geslag volg later

  • @@ -124,7 +124,7 @@

    OorsprongOrigins

    Die familiewapenThe Arms

    Gules, a saltire Or. Mantling Or and Gules. Crest: a pair of eagle's wings folded Or.

    -

    'n Goue sint-andrieskruis op rooi, afgelei van die wapen van die Franse familie Villon de Varennes. Hulle helmteken was 'n goue muurkroon. By die Viljoen-fees van 1976 het die Viljoen Familiebond besluit om dit met die paar goue arendsvlerke hierbo te vervang.

    +

    'n Goue skuinskruis op rooi, afgelei van die wapen van die Franse familie Villon de Varennes. Hulle helmteken was 'n goue muurkroon. By die Viljoen-fees van 1976 het die Viljoen Familiebond gestem om dit met die paar goue arendsvlerke hierbo te vervang.

    diff --git a/sites/viljoen.family/index.html b/sites/viljoen.family/index.html index 0af5f50e..bb1af5b7 100644 --- a/sites/viljoen.family/index.html +++ b/sites/viljoen.family/index.html @@ -45,12 +45,12 @@

    Viljoen

    - Stamouers + Stamouers
    1. -

      a · Stamouers · The founding couple

      +

      a · Stamouers · The founding couple

      François Villion & Cornelia Campenaar

      of Clermont, France · of Middelburg, the Netherlands
      married 1676 at the Cape of Good Hope

      @@ -116,19 +116,19 @@

      François Villion
      -

      OriginsOorsprong

      +

      OriginsOorsprong

      The Viljoens of South Africa descend from François Villion, a French Huguenot from Clermont who reached the Cape of Good Hope in 1671, well before the main Huguenot settlement of 1688.

      In 1676 he married Cornelia Campenaar of Middelburg in the Netherlands, and the couple farmed near Stellenbosch. Their six children were baptized in Cape Town and Stellenbosch between 1677 and 1689, and over the generations the French name Villion settled into its Afrikaans form, Viljoen.

      -

      The ArmsDie familiewapen

      +

      The ArmsDie familiewapen

      Gules, a saltire Or. Mantling Or and Gules. Crest: a pair of eagle's wings folded Or.

      A gold St Andrew's cross on red, derived from the arms of the French family Villon de Varennes. Their crest was a golden mural crown. At the Viljoen Festival of 1976 the Viljoen Familiebond voted to replace it with the pair of golden eagle's wings shown above.

      -

      Further readingVerdere leesstof

      +

      Further readingVerdere leesstof