@luhtech/site-template 0.3.6 → 0.5.0
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
|
@@ -116,6 +116,63 @@ the real schema-registry source, not fabricated) only for this one schema,
|
|
|
116
116
|
and logs a warning when it does. Every other schema fetch failure is a hard
|
|
117
117
|
error.
|
|
118
118
|
|
|
119
|
+
## Article sections, table of contents, linkable blocks
|
|
120
|
+
|
|
121
|
+
Added in 0.4.0 (d-2026-09-08-sr-article-venture-site-bridge), the schema-first
|
|
122
|
+
foundation for bridging business-tools' real article pipeline into a
|
|
123
|
+
venture's own marketing site instead of only dash.luh.tech's bare preview:
|
|
124
|
+
|
|
125
|
+
- `sectionKind: "article"` (`sections/Article.astro`) renders a long-form
|
|
126
|
+
article body -- a real, distinct kind from `proof`/`approach`/etc., since
|
|
127
|
+
none of the existing ten fit an article's own reading experience.
|
|
128
|
+
- `block.blockType` gained `stat` (a styled illustrative/rhetorical
|
|
129
|
+
callout -- never a citable fact; a real sourced number is always a
|
|
130
|
+
section-level `figures[]` entry) and `close` (a marked concluding
|
|
131
|
+
paragraph, styled with a top rule).
|
|
132
|
+
- `block.href` (optional, same shape as `cta.href`) makes any individual
|
|
133
|
+
block a real link -- an `audiences` card pointing at a market-specific
|
|
134
|
+
page, or a `list`/`definition` entry pointing at an article's own page.
|
|
135
|
+
`Block.astro` wraps whatever the blockType already renders in an outer
|
|
136
|
+
`<a>`, so link behavior is uniform across every blockType.
|
|
137
|
+
- `TableOfContents.astro` (new, generic component): derives a real jump-list
|
|
138
|
+
from `page.sections[].heading`, linking each entry to that section's own
|
|
139
|
+
`id={section.sectionId}` (every `sections/*.astro` component already
|
|
140
|
+
stamps this). Renders nothing for a page with 0-1 headinged sections --
|
|
141
|
+
a one-entry TOC is noise, not navigation. Does not attempt to derive
|
|
142
|
+
sub-headings from inside a single article section's `blocks[]` -- the
|
|
143
|
+
article chunk vocabulary (lede/section/pullquote/stat/close) has no
|
|
144
|
+
heading-level chunk, so there is nothing real to link to below
|
|
145
|
+
section-level today.
|
|
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 `←` glyph) with a hover
|
|
166
|
+
micro-interaction, replacing the bare `<a>← 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
|
+
|
|
119
176
|
## Migrating a venture site
|
|
120
177
|
|
|
121
178
|
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.
|
|
3
|
+
"version": "0.5.0",
|
|
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 `← 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 ← 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>
|
|
@@ -3,13 +3,31 @@
|
|
|
3
3
|
// per the schema's own description -- kept as plain text here (no markdown
|
|
4
4
|
// parser dependency); a consumer site that needs real markdown rendering
|
|
5
5
|
// wraps this or replaces it, the contract only requires blockType/text/label.
|
|
6
|
+
//
|
|
7
|
+
// stat/close added in page.schema.json v1.1.0 (d-2026-09-08-sr-article-
|
|
8
|
+
// venture-site-bridge): stat is a styled illustrative/rhetorical callout
|
|
9
|
+
// the piece itself asserts -- never a citable fact (a real sourced number
|
|
10
|
+
// is always a section-level figures[] entry, which carries required
|
|
11
|
+
// public provenance; this block carries none). close is a marked
|
|
12
|
+
// concluding paragraph, same semantics as paragraph, styled with a top
|
|
13
|
+
// rule to read as the piece's final beat.
|
|
14
|
+
//
|
|
15
|
+
// href (also v1.1.0) makes the whole rendered block a real link -- an
|
|
16
|
+
// audiences-section card pointing at a market-specific page, or an
|
|
17
|
+
// article-list entry pointing at that article's own page. Wraps
|
|
18
|
+
// whatever the blockType already renders in an outer <a>, so link
|
|
19
|
+
// behavior is uniform across every blockType without each needing its
|
|
20
|
+
// own href-aware markup.
|
|
6
21
|
export interface Props {
|
|
7
|
-
block: { blockType: string; text: string; label?: string };
|
|
22
|
+
block: { blockType: string; text: string; label?: string; href?: string };
|
|
8
23
|
class?: string;
|
|
9
24
|
}
|
|
10
25
|
const { block, class: className = '' } = Astro.props;
|
|
11
26
|
const items = block.blockType === 'list' ? block.text.split('\n').filter(Boolean) : [];
|
|
27
|
+
const Wrapper = block.href ? 'a' : Fragment;
|
|
28
|
+
const wrapperProps = block.href ? { href: block.href, class: 'block no-underline' } : {};
|
|
12
29
|
---
|
|
30
|
+
<Wrapper {...wrapperProps}>
|
|
13
31
|
{block.blockType === 'paragraph' && (
|
|
14
32
|
<div class={className}>
|
|
15
33
|
{block.label && <p class="font-display font-semibold text-accent-secondary mb-1">{block.label}</p>}
|
|
@@ -35,3 +53,10 @@ const items = block.blockType === 'list' ? block.text.split('\n').filter(Boolean
|
|
|
35
53
|
</ul>
|
|
36
54
|
</div>
|
|
37
55
|
)}
|
|
56
|
+
{block.blockType === 'stat' && (
|
|
57
|
+
<p class={`font-display text-xl font-semibold text-accent-primary bg-accent-primary/5 rounded-md px-4 py-3 ${className}`}>{block.text}</p>
|
|
58
|
+
)}
|
|
59
|
+
{block.blockType === 'close' && (
|
|
60
|
+
<p class={`leading-relaxed border-t border-ink/10 pt-6 ${className}`}>{block.text}</p>
|
|
61
|
+
)}
|
|
62
|
+
</Wrapper>
|
|
@@ -16,6 +16,7 @@ import Status from './sections/Status.astro';
|
|
|
16
16
|
import Sources from './sections/Sources.astro';
|
|
17
17
|
import Cta from './sections/Cta.astro';
|
|
18
18
|
import Legal from './sections/Legal.astro';
|
|
19
|
+
import Article from './sections/Article.astro';
|
|
19
20
|
import CrossLink from './CrossLink.astro';
|
|
20
21
|
|
|
21
22
|
const SECTION_COMPONENTS: Record<string, any> = {
|
|
@@ -29,6 +30,7 @@ const SECTION_COMPONENTS: Record<string, any> = {
|
|
|
29
30
|
sources: Sources,
|
|
30
31
|
cta: Cta,
|
|
31
32
|
legal: Legal,
|
|
33
|
+
article: Article,
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
// icons is an optional, generic per-page mapping a consumer passes to opt a
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Generic, page-level table of contents -- not article-specific. Derived
|
|
3
|
+
// directly from page.sections[].heading (the same real field every
|
|
4
|
+
// sections/*.astro component already renders as its own <h1>/<h2> and
|
|
5
|
+
// stamps as its section's DOM id via id={section.sectionId}), so a TOC
|
|
6
|
+
// entry always points at a real, already-rendered anchor -- never a
|
|
7
|
+
// fabricated one.
|
|
8
|
+
//
|
|
9
|
+
// Deliberately does not attempt to derive sub-headings from inside a
|
|
10
|
+
// single section's blocks[] -- content/article.schema.json's body has no
|
|
11
|
+
// heading-level chunk type (its chunk vocabulary is lede/section/pullquote/
|
|
12
|
+
// stat/close, none of which mark a subheading), so a real article today
|
|
13
|
+
// has nothing below section-level to link to. A consumer with genuinely
|
|
14
|
+
// multi-section content (e.g. an article split into several `article`
|
|
15
|
+
// sections, each with its own heading) gets a real, useful jump-list for
|
|
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.
|
|
25
|
+
export interface Props {
|
|
26
|
+
sections: Array<{ sectionId: string; heading?: string }>;
|
|
27
|
+
class?: string;
|
|
28
|
+
}
|
|
29
|
+
const { sections, class: className = '' } = Astro.props;
|
|
30
|
+
const entries = (sections ?? []).filter((s) => s.heading);
|
|
31
|
+
---
|
|
32
|
+
{entries.length > 1 && (
|
|
33
|
+
<nav class={`text-sm ${className}`} aria-label="Table of contents" data-toc>
|
|
34
|
+
<p class="font-display font-semibold uppercase tracking-wide text-xs text-ink/50 mb-2">On this page</p>
|
|
35
|
+
<ul class="space-y-1.5 border-l border-ink/10">
|
|
36
|
+
{entries.map((s) => (
|
|
37
|
+
<li>
|
|
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
|
+
>
|
|
42
|
+
{s.heading}
|
|
43
|
+
</a>
|
|
44
|
+
</li>
|
|
45
|
+
))}
|
|
46
|
+
</ul>
|
|
47
|
+
</nav>
|
|
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>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
// sectionKind: article -- a long-form article body bridged from
|
|
3
|
+
// content/article.schema.json's canonical body via the article-venture-site
|
|
4
|
+
// channel-render (page.schema.json v1.1.0, d-2026-09-08-sr-article-venture-
|
|
5
|
+
// site-bridge). Blocks render in sequence exactly as authored -- lede first,
|
|
6
|
+
// then paragraph/pullquote/stat blocks in the article's own order, closing
|
|
7
|
+
// with a `close` block if the source article ended with one.
|
|
8
|
+
import Block from '../Block.astro';
|
|
9
|
+
|
|
10
|
+
export interface Props { section: any }
|
|
11
|
+
const { section } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
<section id={section.sectionId} class="py-8" data-reveal>
|
|
14
|
+
{section.eyebrow && <p class="text-sm font-mono uppercase tracking-wide text-accent-primary mb-3">{section.eyebrow}</p>}
|
|
15
|
+
{section.heading && <h1 class="font-display text-3xl sm:text-4xl font-bold mb-3 max-w-2xl">{section.heading}</h1>}
|
|
16
|
+
{section.subheading && <p class="text-lg text-ink/80 max-w-2xl mb-6">{section.subheading}</p>}
|
|
17
|
+
<div class="max-w-2xl space-y-5">
|
|
18
|
+
{section.blocks?.map((b: any) => <Block block={b} />)}
|
|
19
|
+
</div>
|
|
20
|
+
</section>
|