@luhtech/site-template 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -144,6 +144,50 @@ venture's own marketing site instead of only dash.luh.tech's bare preview:
144
144
  heading-level chunk, so there is nothing real to link to below
145
145
  section-level today.
146
146
 
147
+ ## Sticky side-nav and back-navigation (0.5.0)
148
+
149
+ Real long-form/multi-section pages (Platform, Open, About-style pages -- not
150
+ splash/hero landing pages, which have nothing worth jumping to) get the same
151
+ sticky-TOC-plus-scrollspy treatment the rest of the industry has converged on
152
+ (Docusaurus, Mintlify, Nextra, VitePress, Astro Starlight all ship a variant
153
+ of this exact pattern; Stripe's own docs use the sibling breadcrumb
154
+ convention for the same reason -- orient the reader inside a long page):
155
+
156
+ - `TableOfContents.astro` gained real scrollspy: an `IntersectionObserver`
157
+ (the same convention `SiteLayout`'s own `[data-reveal]` reveal-on-scroll
158
+ script already uses, not a second one) tracks which linked section is
159
+ current and stamps `aria-current` on its link. The active link gets a
160
+ persistent left accent-bar + ink color + medium weight -- not just a hover
161
+ state. A consumer wires it exactly as before (`<TableOfContents
162
+ sections={page.sections} />` inside a `sticky` aside); the scrollspy is
163
+ automatic, and degrades to a plain static jump-list if JS never runs.
164
+ - `BackLink.astro` (new): the canonical "back to X" pattern -- a real
165
+ chevron icon (inline SVG, not the `&larr;` glyph) with a hover
166
+ micro-interaction, replacing the bare `<a>&larr; X</a>` markup that had
167
+ been hand-duplicated per consumer. `<BackLink href="/insights/"
168
+ label="Insights" />`.
169
+ - Consumer guidance: only wrap a page's sections in the two-column
170
+ `grid-cols-[1fr_200px]` + sticky-aside layout when it actually has more
171
+ than one headinged section (`page.sections.filter(s => s.heading).length
172
+ > 1` -- the same condition `TableOfContents` itself gates on). Reserving
173
+ an empty 200px rail next to a single-section page is dead space, not
174
+ navigation.
175
+
176
+ ## Icon set: generic vs. construction-specific (0.5.1)
177
+
178
+ `Icon.astro`'s shared ~24-icon set mixes true portfolio-generic icons with
179
+ Ectropy-specific ones (found live building LuhTech-Business's own visual
180
+ system out to the same standard). The file now documents the split
181
+ explicitly in its own header comment -- a consumer wiring `Section`'s
182
+ `icons` prop on a non-construction venture site should only reach for the
183
+ GENERIC subset (location-pin, decision-chain, cost-tag, schema-doc,
184
+ integration-plug, sync-loop, audit-trail, studio-compass, portfolio-grid,
185
+ code-bracket, team-people, handshake, rocket, data-flow, mail-envelope,
186
+ message-bubble, external-link, lock); the remainder (voxel-grid,
187
+ field-inspection, hard-hat, building, field-team, zone-map, change-order,
188
+ crane) reads as borrowed Ectropy content anywhere else. No icons were
189
+ added, removed, or renamed -- documentation only.
190
+
147
191
  ## Migrating a venture site
148
192
 
149
193
  A migration is: author `content/site.<venture>.json` + `content/pages/*.json`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luhtech/site-template",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Shared Astro component library + content-instance contract for LuhTech venture marketing sites -- one template renders every site from content/page.schema.json + content/site.schema.json instances.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -0,0 +1,32 @@
1
+ ---
2
+ // Canonical "back" navigation link -- replaces the bare `&larr; X` text
3
+ // anchor pattern that was hand-duplicated per-consumer (e.g. Ectropy's
4
+ // insights/[slug].astro had it inline, twice, once per content branch).
5
+ // A real chevron (inline SVG, not the &larr; glyph -- consistent stroke
6
+ // weight against the rest of the icon set, and it can carry its own hover
7
+ // motion) plus a label, matching the back-nav language convention used
8
+ // across doc/article surfaces industry-wide (a short, specific "Back to
9
+ // X", not a bare arrow with no destination named).
10
+ export interface Props {
11
+ href: string;
12
+ label: string;
13
+ class?: string;
14
+ }
15
+ const { href, label, class: className = '' } = Astro.props;
16
+ ---
17
+ <a
18
+ href={href}
19
+ class={`group inline-flex items-center gap-1.5 text-sm font-medium text-accent-primary transition-colors hover:text-ink ${className}`}
20
+ >
21
+ <svg
22
+ width="16"
23
+ height="16"
24
+ viewBox="0 0 16 16"
25
+ fill="none"
26
+ aria-hidden="true"
27
+ class="shrink-0 transition-transform duration-200 group-hover:-translate-x-0.5"
28
+ >
29
+ <path d="M10 12.5 5.5 8l4.5-4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
30
+ </svg>
31
+ <span>{label}</span>
32
+ </a>
@@ -6,6 +6,23 @@
6
6
  // is common across the portfolio rather than brand-specific. Copied verbatim
7
7
  // from luh-tech/LuhTech-Business's own Icon.astro -- keep this file in sync
8
8
  // if the shared set grows.
9
+ //
10
+ // d-2026-09-09-sr-article-venture-routing-content-cells (LuhTech-Business
11
+ // build-out): this one file mixes truly portfolio-generic icons with
12
+ // Ectropy-specific ones. A consumer wiring Section's `icons` prop should
13
+ // only reach for the GENERIC subset unless it is genuinely a construction
14
+ // venture -- reaching for a construction icon on a non-construction site
15
+ // (e.g. LuhTech-Business, the holding/consultancy site) would be exactly
16
+ // the "borrowed Ectropy content" mistake this split exists to prevent.
17
+ //
18
+ // GENERIC (safe for any venture): location-pin, decision-chain, cost-tag,
19
+ // schema-doc, integration-plug, sync-loop, audit-trail, studio-compass,
20
+ // portfolio-grid, code-bracket, team-people, handshake, rocket, data-flow,
21
+ // mail-envelope, message-bubble, external-link, lock.
22
+ //
23
+ // CONSTRUCTION-SPECIFIC (Ectropy and other construction-venture sites
24
+ // only): voxel-grid, field-inspection, hard-hat, building, field-team,
25
+ // zone-map, change-order, crane.
9
26
  const ICONS: Record<string, string> = {
10
27
  'voxel-grid': `<rect x="3" y="3" width="8" height="8" rx="1.5"/><rect x="13" y="3" width="8" height="8" rx="1.5"/><rect x="3" y="13" width="8" height="8" rx="1.5"/><rect x="13" y="13" width="8" height="8" rx="1.5"/>`,
11
28
  'location-pin': `<path d="M12 21s7-6.5 7-12a7 7 0 1 0-14 0c0 5.5 7 12 7 12z"/><circle cx="12" cy="9" r="2.25"/>`,
@@ -14,6 +14,14 @@
14
14
  // multi-section content (e.g. an article split into several `article`
15
15
  // sections, each with its own heading) gets a real, useful jump-list for
16
16
  // free; a single-section page simply renders nothing here.
17
+ //
18
+ // Scrollspy (industry-standard sticky-TOC pattern, the same shape
19
+ // Docusaurus/Mintlify/Nextra/VitePress/Astro Starlight all converge on): an
20
+ // IntersectionObserver watches each linked section and marks the current
21
+ // one with aria-current, matching the site's own [data-reveal] observer
22
+ // convention in SiteLayout rather than inventing a second one. Degrades to
23
+ // a plain static jump-list with no active-state if JS never runs -- every
24
+ // link is still a real, working anchor.
17
25
  export interface Props {
18
26
  sections: Array<{ sectionId: string; heading?: string }>;
19
27
  class?: string;
@@ -22,12 +30,15 @@ const { sections, class: className = '' } = Astro.props;
22
30
  const entries = (sections ?? []).filter((s) => s.heading);
23
31
  ---
24
32
  {entries.length > 1 && (
25
- <nav class={`text-sm ${className}`} aria-label="Table of contents">
33
+ <nav class={`text-sm ${className}`} aria-label="Table of contents" data-toc>
26
34
  <p class="font-display font-semibold uppercase tracking-wide text-xs text-ink/50 mb-2">On this page</p>
27
35
  <ul class="space-y-1.5 border-l border-ink/10">
28
36
  {entries.map((s) => (
29
37
  <li>
30
- <a href={`#${s.sectionId}`} class="block pl-3 -ml-px border-l-2 border-transparent text-ink/70 hover:text-ink hover:border-accent-primary transition-colors">
38
+ <a
39
+ href={`#${s.sectionId}`}
40
+ class="block pl-3 -ml-px border-l-2 border-transparent text-ink/70 transition-colors hover:text-ink hover:border-accent-primary [&[aria-current]]:border-accent-primary [&[aria-current]]:text-ink [&[aria-current]]:font-medium"
41
+ >
31
42
  {s.heading}
32
43
  </a>
33
44
  </li>
@@ -35,3 +46,30 @@ const entries = (sections ?? []).filter((s) => s.heading);
35
46
  </ul>
36
47
  </nav>
37
48
  )}
49
+ <script>
50
+ function initScrollSpies() {
51
+ document.querySelectorAll<HTMLElement>('nav[data-toc]').forEach((nav) => {
52
+ const links = Array.from(nav.querySelectorAll<HTMLAnchorElement>('a[href^="#"]'));
53
+ const targets = links
54
+ .map((link) => ({ link, el: document.getElementById(link.getAttribute('href')!.slice(1)) }))
55
+ .filter((t): t is { link: HTMLAnchorElement; el: HTMLElement } => !!t.el);
56
+ if (!targets.length) return;
57
+
58
+ const setActive = (id: string) => {
59
+ for (const { link, el } of targets) {
60
+ link.toggleAttribute('aria-current', el.id === id);
61
+ }
62
+ };
63
+
64
+ const observer = new IntersectionObserver(
65
+ (observerEntries) => {
66
+ const visible = observerEntries.filter((e) => e.isIntersecting);
67
+ if (visible.length) setActive(visible[0].target.id);
68
+ },
69
+ { rootMargin: '-20% 0px -70% 0px', threshold: 0 }
70
+ );
71
+ targets.forEach(({ el }) => observer.observe(el));
72
+ });
73
+ }
74
+ initScrollSpies();
75
+ </script>