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:
@@ -0,0 +1,45 @@
|
||||
{{/*
|
||||
The footer: the brand, [params.footer] tagline and place, the social
|
||||
links (menu footer_social), the link groups in [params.footer] groups
|
||||
(each a title and a menu's name), the legal links (menu footer_legal),
|
||||
and the copyright line.
|
||||
*/}}
|
||||
{{ $b := site.Params.brand | default dict }}
|
||||
{{ $f := site.Params.footer | default dict }}
|
||||
<footer class="foot">
|
||||
<div class="wrap">
|
||||
<div class="foot-top-row">
|
||||
<div class="foot-brand">
|
||||
<a href="{{ "/" | relURL }}" class="foot-mark" aria-label="{{ site.Title }}, home">
|
||||
{{ with $b.logo }}<img src="{{ . | relURL }}" alt="{{ site.Title }}" class="brand-logo">{{ else }}<span class="brand-name">{{ site.Title }}</span>{{ end }}
|
||||
</a>
|
||||
{{ with $f.tagline | default site.Params.tagline }}<p class="foot-line">{{ . }}</p>{{ end }}
|
||||
{{ with $f.place }}<span class="foot-place">{{ . }}</span>{{ end }}
|
||||
{{ with site.Menus.footer_social }}
|
||||
<ul class="foot-social">
|
||||
{{ range . }}<li><a href="{{ .URL }}" target="_blank" rel="noopener">{{ .Name }}<span class="arrow" aria-hidden="true">↗</span></a></li>{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="foot-grid">
|
||||
{{ range $f.groups }}
|
||||
<nav class="foot-group" aria-label="{{ .title }}">
|
||||
<span class="foot-head">{{ .title }}</span>
|
||||
<ul class="foot-links">
|
||||
{{ range index site.Menus .menu }}
|
||||
<li><a href="{{ if or (hasPrefix .URL "mailto:") (hasPrefix .URL "http") }}{{ .URL }}{{ else }}{{ .URL | relURL }}{{ end }}"{{ if .Params.external }} target="_blank" rel="noopener"{{ end }}>{{ .Name }}{{ if .Params.external }}<span class="arrow" aria-hidden="true">↗</span>{{ end }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="foot-legal">
|
||||
<span class="foot-copy">{{ with $f.copyright }}{{ . }}{{ else }}© {{ now.Format "2006" }} {{ site.Title }}{{ end }}</span>
|
||||
{{ range site.Menus.footer_legal }}<a class="foot-policy" href="{{ .URL | relURL }}">{{ .Name }}</a>{{ end }}
|
||||
<a class="foot-top" href="#top">Back to top<span class="foot-up" aria-hidden="true">↑</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -0,0 +1,43 @@
|
||||
{{/* Brand settings ([params.brand] in hugo.toml) override the stylesheet's
|
||||
colors and font; see the theme's README. */}}
|
||||
{{ $b := site.Params.brand | default dict }}
|
||||
{{ $dark := $b.dark | default "#001a2b" }}
|
||||
{{ $dark2 := $b.dark2 | default "#052b42" }}
|
||||
{{ $primary := $b.primary | default "#e0ff4f" }}
|
||||
{{ $accent := $b.accent | default "#614efa" }}
|
||||
{{ $font := $b.font | default "Inter" }}
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{ if .IsHome }}{{ site.Title }}{{ with site.Params.tagline }} — {{ . }}{{ end }}{{ else }}{{ .Title }} · {{ site.Title }}{{ end }}</title>
|
||||
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ site.Params.tagline }}{{ end }}">
|
||||
<meta name="theme-color" content="{{ $dark }}">
|
||||
<link rel="canonical" href="{{ .Permalink }}">
|
||||
<meta property="og:title" content="{{ .Title | default site.Title }}">
|
||||
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{ site.Params.tagline }}{{ end }}">
|
||||
<meta property="og:url" content="{{ .Permalink }}">
|
||||
<meta property="og:type" content="website">
|
||||
{{ with $b.favicon }}<link rel="icon" href="{{ . | relURL }}">{{ end }}
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family={{ $font }}:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ "css/supermarket.css" | relURL }}">
|
||||
<style>
|
||||
:root {
|
||||
--navy-deep: {{ $dark | safeCSS }}; --ink: {{ $dark | safeCSS }};
|
||||
--navy: {{ $dark2 | safeCSS }}; --navy-2: {{ $dark2 | safeCSS }};
|
||||
--lime: {{ $primary | safeCSS }}; --lime-deep: {{ $b.primaryHover | default $primary | safeCSS }}; --live: {{ $primary | safeCSS }};
|
||||
--violet: {{ $accent | safeCSS }}; --violet-deep: {{ $b.accentHover | default $accent | safeCSS }};
|
||||
--violet-7: color-mix(in srgb, {{ $accent | safeCSS }} 7%, transparent);
|
||||
--violet-11: color-mix(in srgb, {{ $accent | safeCSS }} 11%, transparent);
|
||||
--ink-86: color-mix(in srgb, {{ $dark | safeCSS }} 86%, transparent);
|
||||
--ink-68: color-mix(in srgb, {{ $dark | safeCSS }} 68%, transparent);
|
||||
--ink-60: color-mix(in srgb, {{ $dark | safeCSS }} 60%, transparent);
|
||||
--ink-45: color-mix(in srgb, {{ $dark | safeCSS }} 45%, transparent);
|
||||
--ink-22: color-mix(in srgb, {{ $dark | safeCSS }} 22%, transparent);
|
||||
--font: "{{ $font | safeCSS }}", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
||||
}
|
||||
</style>
|
||||
{{ with site.Params.plausible }}{{ if .script }}
|
||||
<script defer data-domain="{{ .domain | default (urls.Parse site.BaseURL).Host }}" src="{{ .script }}"></script>
|
||||
<script>window.plausible = window.plausible || function () { (window.plausible.q = window.plausible.q || []).push(arguments) };</script>
|
||||
{{ end }}{{ end }}
|
||||
@@ -0,0 +1,63 @@
|
||||
{{/*
|
||||
The top bar: the logo (or the site's name), the main menu (a menu entry
|
||||
with `params.dropdown = "<menu>"` opens that menu as a panel), and the
|
||||
buttons in [params.header] ctas. Below 1000px the menu folds into a Menu
|
||||
toggle (a <details>, so it works without JS).
|
||||
*/}}
|
||||
{{ $page := . }}
|
||||
{{ $b := site.Params.brand | default dict }}
|
||||
{{ $ctas := (site.Params.header | default dict).ctas }}
|
||||
<header class="site-head">
|
||||
<div class="wrap head-bar">
|
||||
<a href="{{ "/" | relURL }}" class="brand" aria-label="{{ site.Title }}, home">
|
||||
{{ with $b.logo }}<img src="{{ . | relURL }}" alt="{{ site.Title }}" class="brand-logo">{{ else }}<span class="brand-name">{{ site.Title }}</span>{{ end }}
|
||||
</a>
|
||||
|
||||
<nav class="head-nav" aria-label="Site">
|
||||
{{ range .Site.Menus.main }}
|
||||
{{ if ne .URL "/" }}
|
||||
{{ $m := . }}
|
||||
{{ $active := hasPrefix $page.RelPermalink .URL }}
|
||||
{{ with .Params.dropdown }}
|
||||
<div class="nav-item has-drop">
|
||||
<a href="{{ $m.URL | relURL }}" class="nav-link"{{ if $active }} aria-current="page"{{ end }}>{{ $m.Name }}<svg class="nav-caret" viewBox="0 0 10 6" width="10" height="6" aria-hidden="true"><path d="M1 1l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5"/></svg></a>
|
||||
<div class="drop">
|
||||
<div class="drop-panel">
|
||||
{{ range index $page.Site.Menus . }}
|
||||
<a href="{{ .URL | relURL }}" class="drop-link"{{ if eq $page.RelPermalink .URL }} aria-current="page"{{ end }}>
|
||||
<span class="drop-name">{{ .Name }}</span>
|
||||
{{ with .Params.desc }}<span class="drop-desc">{{ . }}</span>{{ end }}
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ else }}
|
||||
<a href="{{ $m.URL | relURL }}" class="nav-link"{{ if $active }} aria-current="page"{{ end }}>{{ $m.Name }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</nav>
|
||||
|
||||
{{ with $ctas }}
|
||||
<div class="head-actions">
|
||||
{{ range . }}<a href="{{ .url | relURL }}" class="{{ if eq .style "ghost" }}head-signin{{ else }}btn btn-primary btn-sm{{ end }}">{{ .label }}</a>{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<details class="menu">
|
||||
<summary><span class="menu-word">Menu</span><span class="menu-glyph" aria-hidden="true"><i></i><i></i></span></summary>
|
||||
<nav class="menu-panel" aria-label="Site">
|
||||
{{ range .Site.Menus.main }}
|
||||
<a href="{{ .URL | relURL }}" class="menu-top">{{ .Name }}</a>
|
||||
{{ with .Params.dropdown }}
|
||||
<div class="menu-sub">
|
||||
{{ range index $page.Site.Menus . }}<a href="{{ .URL | relURL }}">{{ .Name }}</a>{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ with $ctas }}<div class="menu-actions">{{ partial "sections/ctas.html" . }}</div>{{ end }}
|
||||
</nav>
|
||||
</details>
|
||||
</div>
|
||||
</header>
|
||||
@@ -0,0 +1,9 @@
|
||||
{{ range .Params.sections }}
|
||||
{{ if eq .type "hero" }}
|
||||
{{ partial "sections/hero.html" . }}
|
||||
{{ else if eq .type "final-cta" }}
|
||||
{{ partial "sections/final-cta.html" . }}
|
||||
{{ else if templates.Exists (printf "partials/sections/%s.html" .type) }}
|
||||
{{ partial "sections/wrapper.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{/*
|
||||
Anchor id for a section: its own `id`, else one made from its `toc`,
|
||||
`kicker`, or `headline`. Used by the section wrapper.
|
||||
*/}}
|
||||
{{ $id := "" }}
|
||||
{{ with .id }}
|
||||
{{ $id = . }}
|
||||
{{ else }}
|
||||
{{ with (or .toc .kicker .headline) }}{{ $id = . | plainify | anchorize }}{{ end }}
|
||||
{{ end }}
|
||||
{{ return $id }}
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user