Phase 6 part 5, step 1: a shared site theme

internal/theme embeds a Hugo theme from federated-website's look and the
13 section types both sites share, with the header, footer, colors, font
and logo set per site in hugo.toml, and a README of each type's fields.
The catalogue reader reads themes' sections and READMEs after the site's
own; lead forms know a theme site needs only the Lead Capture address.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 15:14:24 -07:00
co-authored by Claude Opus 5.5
parent 98913971ea
commit 5d7db5c5bf
36 changed files with 2641 additions and 79 deletions
@@ -0,0 +1,4 @@
{{ $s := . }}
{{ partial "sections/head.html" $s }}
{{ with $s.intro }}<div class="prose mb-2">{{ . | markdownify }}</div>{{ end }}
<div class="callout"><p>{{ $s.text | markdownify }}</p></div>
@@ -0,0 +1,22 @@
{{/*
A grid of cards: `items`, each with `title`, `body`, optional `label`
(a small tag above the title), `image`, and `link` (+ `linktext`).
Without an image, `visual: true` draws a gradient panel in its place.
*/}}
{{ $s := . }}
{{ partial "sections/head.html" $s }}
<ul class="card-grid{{ with $s.columns }} cols-{{ . }}{{ end }}">
{{ range $i, $c := $s.items }}
<li class="card{{ if or $c.image $s.visual }} has-visual{{ end }}">
{{ with $c.image }}<img class="card-visual" src="{{ . | relURL }}" alt="" loading="lazy">
{{ else }}{{ if $s.visual }}<span class="card-visual card-art" style="--i:{{ $i }}" aria-hidden="true"></span>{{ end }}{{ end }}
<div class="card-body">
{{ with $c.label }}<span class="card-label">{{ . }}</span>{{ end }}
<h3 class="card-title">{{ $c.title | markdownify }}</h3>
{{ with $c.body }}<p class="card-text">{{ . | markdownify }}</p>{{ end }}
{{ with $c.link }}<a class="more card-link" href="{{ . | relURL }}">{{ replaceRE `\s*[→↗]\s*$` "" ($c.linktext | default "Learn more") }}<span class="arrow" aria-hidden="true">→</span></a>{{ end }}
</div>
</li>
{{ end }}
</ul>
{{ if $s.ctas }}<div class="cta-row">{{ partial "sections/ctas.html" $s.ctas }}</div>{{ end }}
@@ -0,0 +1,5 @@
{{ $s := . }}
{{ partial "sections/head.html" $s }}
<ul class="check-list">
{{ range $s.items }}<li>{{ . | markdownify }}</li>{{ end }}
</ul>
@@ -0,0 +1,17 @@
{{/*
Buttons. `primary` is the solid lime button, `ghost` the outlined
secondary, `text` a quiet link with an arrow. Any trailing "→" in a
label is dropped — the arrow is drawn.
*/}}
{{ range . }}
{{ $label := replaceRE `\s*[→↗]\s*$` "" .label }}
{{ $external := or (hasPrefix .url "http") (hasPrefix .url "mailto:") }}
{{ $href := cond (or $external (hasPrefix .url "#")) .url (.url | relURL) }}
{{ if eq .style "ghost" }}
<a href="{{ $href }}" class="btn btn-secondary">{{ $label }}<span class="arrow" aria-hidden="true">{{ if $external }}↗{{ else }}→{{ end }}</span></a>
{{ else if eq .style "text" }}
<a href="{{ $href }}" class="more">{{ $label }}<span class="arrow" aria-hidden="true">{{ if $external }}↗{{ else }}→{{ end }}</span></a>
{{ else }}
<a href="{{ $href }}" class="btn btn-primary">{{ $label }}<span class="arrow" aria-hidden="true">{{ if $external }}↗{{ else }}→{{ end }}</span></a>
{{ end }}
{{ end }}
@@ -0,0 +1,11 @@
{{ $s := . }}
{{ partial "sections/head.html" $s }}
<div class="faq-list">
{{ range $s.items }}
<details class="faq-item">
<summary>{{ .q }}</summary>
<div class="faq-answer"><p>{{ .a | markdownify }}</p></div>
</details>
{{ end }}
</div>
{{ if $s.ctas }}<div class="cta-row mt-2">{{ partial "sections/ctas.html" $s.ctas }}</div>{{ end }}
@@ -0,0 +1,8 @@
{{ $s := . }}
{{ partial "sections/head.html" $s }}
{{ with $s.intro }}<div class="prose mb-2">{{ . | markdownify }}</div>{{ end }}
<ul class="feature-list">
{{ range $s.items }}
<li><strong>{{ .label }}</strong>{{ .body | markdownify }}</li>
{{ end }}
</ul>
@@ -0,0 +1,10 @@
{{ $s := . }}
<aside class="cta" data-reveal>
<div class="wrap cta-inner">
<div class="cta-copy">
<h2 class="cta-title">{{ $s.headline | markdownify }}</h2>
{{ with $s.body }}<p class="cta-text">{{ . | markdownify }}</p>{{ end }}
</div>
{{ if $s.ctas }}<div class="actions">{{ partial "sections/ctas.html" $s.ctas }}</div>{{ end }}
</div>
</aside>
@@ -0,0 +1,103 @@
{{/*
A lead form: the heading, lede, and an optional `points` list on the
left; the form on the right. `fields` take `name`, `label`, `type`
(text, email, number, select, textarea; default text), optional
`options` (select), `placeholder`, `hint`, `required`, and `half: true`
to sit two to a row. `submit` labels the button; `subject` names the lead
(e.g. "Partner platform"); `success` is shown once it's sent.
Where it goes: `[params.leads] action` in hugo.toml. When set, the form
POSTs its fields there (with `source` and `page` added) and shows
`success`. When empty, it opens an email to `[params.leads] email` with
the answers filled in, so leads still arrive before a backend exists.
Without JS, the form falls back to a plain POST (or mailto) of the same.
*/}}
<script src="{{ "js/supermarket-leads.js" | relURL }}"></script>
{{ $s := . }}
{{ $leads := site.Params.leads | default dict }}
{{ $action := $leads.action | default "" }}
{{ $email := $leads.email | default site.Params.supportEmail }}
{{ $subject := $s.subject | default "Website inquiry" }}
<div class="lead">
<div class="lead-copy">
{{ partial "sections/head.html" $s }}
{{ with $s.points }}
<ul class="check-list lead-points">
{{ range . }}<li>{{ . | markdownify }}</li>{{ end }}
</ul>
{{ end }}
{{ with $s.note }}<p class="lead-note">{{ . | markdownify }}</p>{{ end }}
</div>
<form class="lead-form"
{{ if $action }}action="{{ $action }}" method="post"{{ else }}action="{{ printf "mailto:%s?subject=%s" $email (replace (urlquery $subject) "+" "%20") | safeURL }}" method="post" enctype="text/plain"{{ end }}
data-lead="{{ if $action }}post{{ else }}mailto{{ end }}"
data-email="{{ $email }}" data-subject="{{ $subject }}">
<input type="hidden" name="source" value="{{ $subject }}">
{{ range $i, $f := $s.fields }}
{{ $id := printf "lead-%s" $f.name }}
{{ $type := $f.type | default "text" }}
<div class="field{{ if $f.half }} field-half{{ end }}">
<label for="{{ $id }}">{{ $f.label }}{{ if not $f.required }} <span class="field-optional">Optional</span>{{ end }}</label>
{{ if eq $type "select" }}
<select id="{{ $id }}" name="{{ $f.name }}"{{ if $f.required }} required{{ end }}>
<option value="" disabled selected>{{ $f.placeholder | default "Choose one" }}</option>
{{ range $f.options }}<option>{{ . }}</option>{{ end }}
</select>
{{ else if eq $type "textarea" }}
<textarea id="{{ $id }}" name="{{ $f.name }}" rows="3"{{ with $f.placeholder }} placeholder="{{ . }}"{{ end }}{{ if $f.required }} required{{ end }}></textarea>
{{ else }}
<input id="{{ $id }}" name="{{ $f.name }}" type="{{ $type }}"{{ with $f.placeholder }} placeholder="{{ . }}"{{ end }}{{ if eq $type "email" }} autocomplete="email"{{ else if eq $f.name "name" }} autocomplete="name"{{ else if in (slice "company" "organization") $f.name }} autocomplete="organization"{{ end }}{{ if eq $type "number" }} min="0" inputmode="numeric"{{ end }}{{ if $f.required }} required{{ end }}>
{{ end }}
{{ with $f.hint }}<small>{{ . }}</small>{{ end }}
</div>
{{ end }}
<button type="submit" class="btn btn-primary">{{ $s.submit | default "Send" }}<span class="arrow" aria-hidden="true">→</span></button>
<p class="lead-status" role="status" aria-live="polite" hidden></p>
<p class="lead-privacy">We'll use this only to reply to you. No newsletters unless you ask. See our <a href="{{ "/privacy-policy/" | relURL }}">Privacy Policy</a>.</p>
</form>
</div>
<script>
(function () {
var form = document.currentScript.previousElementSibling.querySelector('form');
var status = form.querySelector('.lead-status');
var success = {{ $s.success | default "Thanks — we've got it and will be in touch soon." }};
function show(msg, ok) {
status.hidden = false;
status.textContent = msg;
status.className = 'lead-status ' + (ok ? 'is-ok' : 'is-error');
}
form.addEventListener('submit', function (e) {
if (!form.checkValidity()) return;
e.preventDefault();
var data = new FormData(form);
data.append('page', location.pathname);
if (window.plausible) plausible('Lead', { props: { source: form.dataset.subject } });
if (form.dataset.lead === 'mailto') {
var lines = [];
form.querySelectorAll('.field').forEach(function (f) {
var el = f.querySelector('input, select, textarea');
lines.push(f.querySelector('label').childNodes[0].textContent.trim() + ': ' + (el.value || '—'));
});
location.href = 'mailto:' + form.dataset.email + '?subject=' + encodeURIComponent(form.dataset.subject) +
'&body=' + encodeURIComponent(lines.join('\n') + '\n\nPage: ' + location.href);
show('Your email app should open with your answers filled in. Just press send.', true);
return;
}
var btn = form.querySelector('button');
btn.disabled = true;
(window.leadPost ? window.leadPost(form, data) : fetch(form.action, { method: 'POST', body: data, headers: { Accept: 'application/json' } }))
.then(function (r) {
if (!r.ok) throw new Error(r.status);
form.reset();
form.querySelectorAll('.field').forEach(function (f) { f.hidden = true; });
btn.hidden = true;
show(success, true);
})
.catch(function () {
btn.disabled = false;
show('Something went wrong sending that. Please try again, or email ' + form.dataset.email + '.', false);
});
});
})();
</script>
@@ -0,0 +1,8 @@
{{/* Shared section heading: optional kicker (a mono eyebrow), headline, and lede. */}}
{{ if or .kicker .headline .lede }}
<div class="section-head">
{{ with .kicker }}<p class="eyebrow">{{ . }}</p>{{ end }}
{{ with .headline }}<h2>{{ . | markdownify }}</h2>{{ end }}
{{ with .lede }}<p class="lede">{{ . | markdownify }}</p>{{ end }}
</div>
{{ end }}
@@ -0,0 +1,93 @@
{{/*
The opening of every page: a full-bleed dark band. On the left, an
optional note (the eyebrow), the statement (title), the dek (subhead) and
the actions (ctas); on the right, when `log:` is set, an activity log
typed out line by line. `compact: true` makes it shorter; `logImage` sets
a photo behind the whole band (`logCaption` credits it).
*/}}
{{ $s := . }}
{{ $visual := $s.log }}
<header class="hero{{ if $s.compact }} hero-compact{{ end }}{{ if $visual }} has-visual{{ end }}{{ if $s.logImage }} has-image{{ end }}">
{{ with $s.logImage }}<img class="hero-bg" src="{{ . | relURL }}" alt="" fetchpriority="high">{{ end }}
<div class="wrap hero-grid">
<div class="hero-copy">
{{ with $s.eyebrow }}<p class="note" data-reveal><span class="note-live" aria-hidden="true"></span><span class="note-text">{{ . }}</span></p>{{ end }}
<h1 class="statement" data-reveal style="--d:80ms">{{ $s.title | markdownify }}</h1>
{{ with $s.subhead }}<p class="dek" data-reveal style="--d:140ms">{{ . | markdownify }}</p>{{ end }}
{{ if $s.ctas }}<div class="actions" data-reveal style="--d:200ms">{{ partial "sections/ctas.html" $s.ctas }}</div>{{ end }}
</div>
{{ with $s.log }}
{{/*
An agent's activity log, typed out line by line (see the script below).
Lines take `tag` + `text`; `think: true` marks a reasoning step (greyed,
with a pause); `done: true` closes the run. The window keeps a fixed
height and scrolls as lines arrive. `logCaption` credits the photo.
*/}}
<figure class="hero-log" data-reveal style="--d:260ms">
<div class="log-window">
<div class="log-bar">
<span class="log-title">{{ $s.logTitle | default "activity" }}</span>
<span class="log-live"><span class="note-live" aria-hidden="true"></span>Live</span>
</div>
<div class="log-view">
<ol class="log-lines" aria-label="{{ $s.logTitle | default "Activity" }}">
{{ range . }}
<li class="log-line{{ if .done }} is-done{{ end }}{{ if .think }} is-think{{ end }}">
<span class="log-tag">{{ .tag | default (cond .done "Done" (cond (.think | default false) "Thinking" "")) }}</span>
<span class="log-text">{{ .text }}</span>
</li>
{{ end }}
</ol>
</div>
</div>
</figure>
<script>
(function () {
var fig = document.currentScript.previousElementSibling;
if (!fig || matchMedia('(prefers-reduced-motion: reduce)').matches) return;
var view = fig.querySelector('.log-view'), list = fig.querySelector('.log-lines');
var lines = [].slice.call(fig.querySelectorAll('.log-line'));
var onScreen = true, i = 0;
function visible() { return onScreen && !document.hidden; }
fig.classList.add('is-animated');
lines.forEach(function (li) {
li.style.setProperty('--n', li.querySelector('.log-text').textContent.trim().length);
});
// Pause while the log is off screen or the tab is hidden.
function schedule(fn, ms) { setTimeout(function () { if (visible()) fn(); else schedule(fn, 400); }, ms); }
function next() {
if (i === lines.length) { schedule(reset, 4200); return; }
var li = lines[i++], n = +li.style.getPropertyValue('--n');
// Finished lines drop their typing animation, so a repaint can't replay it.
lines.forEach(function (l) { if (l.classList.contains('is-current')) l.classList.add('is-typed'); l.classList.remove('is-current'); });
li.classList.add('is-on', 'is-current');
// Keep the newest line in view, like a terminal: slide the list up.
var shift = Math.max(0, li.offsetTop + li.offsetHeight + 18 - view.clientHeight);
list.style.transform = 'translateY(' + -shift + 'px)';
var pause = li.classList.contains('is-think') ? 1300 : li.classList.contains('is-done') ? 300 : 450;
schedule(next, n * 16 + pause);
}
function reset() {
fig.classList.add('is-clearing');
schedule(function () {
lines.forEach(function (l) { l.classList.remove('is-on', 'is-current', 'is-typed'); });
list.style.transition = 'none';
list.style.transform = '';
void list.offsetHeight;
list.style.transition = '';
fig.classList.remove('is-clearing');
i = 0;
schedule(next, 500);
}, 450);
}
if ('IntersectionObserver' in window) {
new IntersectionObserver(function (e) { onScreen = e[0].isIntersecting; }).observe(fig);
}
schedule(next, 700);
})();
</script>
{{ end }}
</div>
{{ with $s.logCaption }}<p class="hero-caption">{{ . }}</p>{{ end }}
</header>
@@ -0,0 +1,14 @@
{{/* Two columns, each a heading plus a short list. */}}
{{ $s := . }}
{{ partial "sections/head.html" $s }}
<div class="split">
{{ range $s.columns }}
<div class="split-col">
<h3>{{ .title }}</h3>
<ul class="split-list">
{{ range .items }}<li>{{ . | markdownify }}</li>{{ end }}
</ul>
</div>
{{ end }}
</div>
{{ if $s.ctas }}<div class="cta-row mt-2">{{ partial "sections/ctas.html" $s.ctas }}</div>{{ end }}
@@ -0,0 +1,45 @@
{{/*
Stat tiles. Values that start with a number ("80%+", "100+", "30X") count
up from zero when the row scrolls into view; others show as written.
Without JS or with reduced motion, every value simply shows.
*/}}
{{ $s := . }}
{{ partial "sections/head.html" $s }}
<div class="stat-row">
{{ range $s.items }}
<div class="stat">
<span class="stat-value">{{ .value }}</span>
<span class="stat-label">{{ .label }}</span>
</div>
{{ end }}
</div>
<script>
(function () {
var row = document.currentScript.previousElementSibling;
if (!('IntersectionObserver' in window) || matchMedia('(prefers-reduced-motion: reduce)').matches) return;
var counters = [];
row.querySelectorAll('.stat-value').forEach(function (el) {
var m = el.textContent.trim().match(/^(\d+)(.*)$/);
if (!m) return;
var shown = document.createElement('span'), full = el.textContent.trim();
shown.setAttribute('aria-hidden', 'true');
shown.textContent = '0' + m[2];
el.innerHTML = '<span class="visually-hidden"></span>';
el.firstChild.textContent = full;
el.appendChild(shown);
counters.push({ node: shown, to: +m[1], suffix: m[2] });
});
if (!counters.length) return;
new IntersectionObserver(function (entries, io) {
if (!entries[0].isIntersecting) return;
io.disconnect();
var start = performance.now(), dur = 1200;
(function tick(now) {
var t = Math.min(1, (now - start) / dur), eased = 1 - Math.pow(1 - t, 3);
counters.forEach(function (c) { c.node.textContent = Math.round(c.to * eased) + c.suffix; });
if (t < 1) requestAnimationFrame(tick);
})(start);
}, { threshold: 0.6 }).observe(row);
})();
</script>
{{ if $s.ctas }}<div class="cta-row mt-2">{{ partial "sections/ctas.html" $s.ctas }}</div>{{ end }}
@@ -0,0 +1,13 @@
{{ $s := . }}
{{ partial "sections/head.html" $s }}
<ol class="step-row{{ if eq (len $s.items) 4 }} steps-4{{ end }}">
{{ range $i, $item := $s.items }}
<li class="step">
<div class="step-head">
<h3>{{ $item.title }}</h3>
<span class="step-num">{{ printf "%03d" (add $i 1) }}</span>
</div>
<p>{{ $item.body | markdownify }}</p>
</li>
{{ end }}
</ol>
@@ -0,0 +1,28 @@
{{ $s := . }}
{{ partial "sections/head.html" $s }}
<div class="table-scroll">
<table class="compare-table">
<thead>
<tr>
<th></th>
{{ range $s.headers }}<th>{{ . }}</th>{{ end }}
</tr>
</thead>
<tbody>
{{ range $s.rows }}
{{ $n := len .cells }}
<tr>
<th>{{ .label }}</th>
{{ range $i, $cell := .cells }}
{{ if eq (add $i 1) $n }}
<td class="good">{{ $cell }}</td>
{{ else }}
<td class="bad">{{ $cell }}</td>
{{ end }}
{{ end }}
</tr>
{{ end }}
</tbody>
</table>
</div>
{{ if $s.ctas }}<div class="cta-row mt-2">{{ partial "sections/ctas.html" $s.ctas }}</div>{{ end }}
@@ -0,0 +1,20 @@
{{/*
Prose, with optional `ctas`. `offer` adds a highlighted card below:
`badge` (a small lime tag), `text`, and `ctas`.
*/}}
{{ $s := . }}
{{ partial "sections/head.html" $s }}
{{/* markdownify drops the <p> around a lone paragraph; put it back so inline markup stays in the flow */}}
{{ $body := $s.body | markdownify }}
{{ if not (findRE `^\s*<(p|ul|ol|h[1-6]|div|blockquote|pre|table|figure|hr)[\s>]` $body) }}{{ $body = printf "<p>%s</p>" $body | safeHTML }}{{ end }}
<div class="prose{{ if $s.centered }} centered{{ end }}">
{{ $body }}
</div>
{{ if $s.ctas }}<div class="cta-row mt-2">{{ partial "sections/ctas.html" $s.ctas }}</div>{{ end }}
{{ with $s.offer }}
<div class="offer-card">
{{ with .badge }}<span class="offer-badge">{{ . }}</span>{{ end }}
<p class="offer-text">{{ .text | markdownify }}</p>
{{ with .ctas }}<div class="offer-actions">{{ partial "sections/ctas.html" . }}</div>{{ end }}
</div>
{{ end }}
@@ -0,0 +1,7 @@
{{ $s := . }}
{{ $id := partial "section-id.html" $s }}
<section class="section section-{{ $s.type }}"{{ with $id }} id="{{ . }}"{{ end }} data-reveal>
<div class="wrap">
{{ partial (printf "sections/%s.html" $s.type) $s }}
</div>
</section>