@ninjainfosys/site-kit 0.0.0-stage → 0.2.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.
Files changed (48) hide show
  1. package/README.md +99 -2
  2. package/bin/site-kit.mjs +24 -0
  3. package/package.json +40 -4
  4. package/src/components/blog/Pager.astro +60 -0
  5. package/src/components/blog/PostCard.astro +53 -0
  6. package/src/components/blog/PostList.astro +21 -0
  7. package/src/components/blog/Story.astro +63 -0
  8. package/src/components/blog/Topics.astro +23 -0
  9. package/src/components/seo/Seo.astro +46 -0
  10. package/src/components/site/CtaBand.astro +21 -0
  11. package/src/components/site/DashainPopup.astro +324 -0
  12. package/src/components/site/Faq.astro +37 -0
  13. package/src/components/site/Footer.astro +66 -0
  14. package/src/components/site/Header.astro +311 -0
  15. package/src/components/site/Related.astro +44 -0
  16. package/src/config.ts +56 -0
  17. package/src/contract.ts +181 -0
  18. package/src/integration.d.mts +4 -0
  19. package/src/integration.mjs +96 -0
  20. package/src/layouts/Base.astro +65 -0
  21. package/src/lib/blog-schema.ts +60 -0
  22. package/src/lib/blog.ts +64 -0
  23. package/src/lib/glossary-types.ts +25 -0
  24. package/src/lib/glossary.ts +21 -0
  25. package/src/lib/posts.ts +22 -0
  26. package/src/lib/rehype-figures.mjs +25 -0
  27. package/src/lib/seo.ts +176 -0
  28. package/src/pages/blog/[slug].astro +274 -0
  29. package/src/pages/blog/index.astro +111 -0
  30. package/src/pages/blog/page/[page].astro +32 -0
  31. package/src/pages/blog/tag/[tag].astro +38 -0
  32. package/src/pages/glossary/[slug].astro +125 -0
  33. package/src/pages/glossary/index.astro +51 -0
  34. package/src/pages/llms.txt.ts +25 -0
  35. package/src/pages/og/[...slug].png.ts +61 -0
  36. package/src/pages/rss.xml.ts +23 -0
  37. package/src/scripts/a11y.mjs +38 -0
  38. package/src/scripts/check-credits.mjs +31 -0
  39. package/src/scripts/check-site.mjs +198 -0
  40. package/src/scripts/commons.mjs +106 -0
  41. package/src/scripts/config.mjs +19 -0
  42. package/src/scripts/indexnow.mjs +25 -0
  43. package/src/scripts/redirects.mjs +55 -0
  44. package/src/scripts/sitemap.mjs +173 -0
  45. package/src/styles/base.css +164 -0
  46. package/src/styles/blog-serif.css +2 -0
  47. package/src/styles/motion.css +20 -0
  48. package/src/virtual.d.ts +4 -0
package/README.md CHANGED
@@ -1,3 +1,100 @@
1
- # Temporary Holding Version
1
+ # @ninjainfosys/site-kit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Shared parts of the Ninja Infosys marketing sites (Astro 5, static output): the blog, the glossary, SEO and structured data, share cards, RSS, llms.txt, the base layout, header, footer, and the build and audit commands. A site keeps its own brand, pages and data and reads everything else from here.
4
+
5
+ ## Use it
6
+
7
+ ```sh
8
+ pnpm add @ninjainfosys/site-kit
9
+ ```
10
+
11
+ ```js
12
+ // astro.config.mjs
13
+ import { defineConfig } from 'astro/config';
14
+ import siteKit from '@ninjainfosys/site-kit/integration';
15
+
16
+ export default defineConfig({
17
+ integrations: [siteKit()],
18
+ });
19
+ ```
20
+
21
+ ```json
22
+ "scripts": {
23
+ "build": "site-kit redirects && astro build && site-kit sitemap dist",
24
+ "check": "site-kit credits && site-kit check dist"
25
+ }
26
+ ```
27
+
28
+ The package ships `.astro` and `.ts` source. The integration tells Vite to compile it (`ssr.noExternal`), to resolve one copy of `astro`, and to keep `@resvg/resvg-js` (a native module) external. The site must depend on `@resvg/resvg-js` itself so the share-card page can load it at build time.
29
+
30
+ ## What the integration does
31
+
32
+ `siteKit(options)` runs in `astro:config:setup` and:
33
+
34
+ - aliases `@site` to the site's `src/`, so kit code can import site modules as `@site/config/site`;
35
+ - adds the `rehypeFigures` markdown plugin (an image alone in a paragraph becomes a `<figure>` with its title as caption);
36
+ - injects the pages below.
37
+
38
+ | Page | Routes | Turn off with |
39
+ | --- | --- | --- |
40
+ | `blog` | `/blog`, `/blog/[slug]`, `/blog/page/[page]`, `/blog/tag/[tag]` | `pages: { blog: false }` |
41
+ | `glossary` | `/glossary`, `/glossary/[slug]` | `pages: { glossary: false }` |
42
+ | `og` | `/og/[...slug].png` | `pages: { og: false }` |
43
+ | `rss` | `/rss.xml` | `pages: { rss: false }` |
44
+ | `llms` | `/llms.txt` | `pages: { llms: false }` |
45
+
46
+ ## The site contract
47
+
48
+ The types are in `src/contract.ts`. A site provides these files under `src/`.
49
+
50
+ | File | What the kit reads |
51
+ | --- | --- |
52
+ | `config/site.ts` | `SITE_URL`, `SITE_NAME` (required). Optional: `COMPANY`, `CONTACT_EMAIL`, `CONTACT_PHONE_DISPLAY`, `CONTACT_PHONE_TEL`, `CONTACT_PHONE_JSONLD`, `OFFICE_LINE`, `LEGAL_ADDRESS`, `LEGAL_ADDRESS_LINE`, `SOCIAL_PROFILES`, `PARENT_COMPANY_NAME`, `PARENT_COMPANY_URL`, `PARENT_COMPANY_ID`, `TAG_ACRONYMS`. |
53
+ | `config/kit.ts` | `export const kit: SiteKit`. Required: `header`, `footer`, `cta`, `og`, `llms`. Optional with defaults: `blog`, `seo`, `head`, `glossary`, `dashain`. |
54
+ | `data/links.ts` | `productTags`, `productLink(slug)`, `productsForTags(tags)`, `solutionsForTags(tags)` (type `SiteLinks`). Return empty results on a site without products. |
55
+ | `layouts/Base.astro` | The site's layout. A site with nothing extra renders `@ninjainfosys/site-kit/layouts/Base.astro` and forwards its props. Slots on the kit layout: `head` (existing), `head-end`, `scripts`, `body-end`. Write the slot elements with no whitespace between them or it leaks into `<main>`. |
56
+ | `styles/site.css` | Imports the site's fonts and tokens, then `@ninjainfosys/site-kit/styles/base.css` and `motion.css`, then rules only that site uses. |
57
+ | `data/glossary/terms/*.ts` | One `Term` per file, default export. Only when the glossary is on. |
58
+ | `content.config.ts` | The `blog` collection, with `postSchema` from `@ninjainfosys/site-kit/lib/blog-schema`. |
59
+
60
+ Tokens the kit's CSS expects the site to define: `--canvas --surface --subtle --line --ink --ink-muted --brand --on-brand --link --lime --on-lime --stage --stage-ink --stage-muted --stage-line --error --space-* --radius-* --fast --slow --ease --font-*`. The header's featured link uses `--lime`; a site whose accent has another name aliases it.
61
+
62
+ Site code imports kit modules by package path, for example `@ninjainfosys/site-kit/components/site/Faq.astro` and `@ninjainfosys/site-kit/lib/posts`.
63
+
64
+ ### Header and footer
65
+
66
+ The header is data. `kit.header` carries the logo, the utility strip, mega-menu groups with one featured link each, plain links, the bar action and the mobile sheet links. `action.google: true` draws Google's own sign-in button with the link as its fallback. Sites with a mark and a name instead of a wide lockup add their own `.site-header .logo` rules in `styles/site.css`. `kit.footer` carries the mark and the link columns; contact lines come from `config/site.ts`.
67
+
68
+ ## Commands
69
+
70
+ `site-kit <command>` runs from the site's root and reads `site-kit.config.mjs` there.
71
+
72
+ | Command | Does |
73
+ | --- | --- |
74
+ | `check [dist]` | Audits the built site against the launch ledger rows code can check. |
75
+ | `credits` | Fails when a blog image has no credit. |
76
+ | `commons` | Fetches an image and its credit from Wikimedia Commons or Openverse. |
77
+ | `sitemap [dist]` | Writes `dist/sitemap.xml` from the built pages. |
78
+ | `indexnow [paths]` | Pings IndexNow for the sitemap URLs or the given paths. |
79
+ | `redirects` | Writes `docs/nginx-redirects.conf` and `public/_redirects`. |
80
+ | `a11y [url]` | axe-core scan of every built page. Needs `axe-core` and `puppeteer-core` in the site. |
81
+
82
+ ```js
83
+ // site-kit.config.mjs
84
+ export default {
85
+ site: 'https://example.com', // required by check, sitemap, indexnow, redirects
86
+ check: { platformNamesAllowed: [] }, // dist pages that may name chat platforms
87
+ sitemap: { notPages: [] }, // top-level paths that are not pages (og is always left out)
88
+ redirects: {
89
+ exact: new Map(), // old path -> new path or URL
90
+ nginx: { share: [] }, // extra nginx lines before the trailing-slash rule
91
+ cloudflare: { tail: [] }, // extra _redirects lines after the exact list
92
+ },
93
+ };
94
+ ```
95
+
96
+ The scripts' functions (`audit`, `pathFor`, `exact`, `nginxConf` ...) are importable from `@ninjainfosys/site-kit/scripts/<name>.mjs` for tests.
97
+
98
+ ## Working on the kit
99
+
100
+ While sites link it (`"@ninjainfosys/site-kit": "link:../site-kit"`), edits show up in a running `astro dev`. Run `pnpm install` in this repo once so the kit's own dependencies (satori, the fontsource packages, node-html-parser) resolve. After a change, build a site and compare its `dist/` before and after.
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ // site-kit <command> [args]: build and audit tooling shared by the sites.
3
+ // Run from the site's root; each command reads site-kit.config.mjs there.
4
+ import { spawnSync } from 'node:child_process';
5
+ import { fileURLToPath } from 'node:url';
6
+
7
+ const COMMANDS = {
8
+ check: 'check-site.mjs',
9
+ credits: 'check-credits.mjs',
10
+ commons: 'commons.mjs',
11
+ sitemap: 'sitemap.mjs',
12
+ indexnow: 'indexnow.mjs',
13
+ redirects: 'redirects.mjs',
14
+ a11y: 'a11y.mjs',
15
+ };
16
+
17
+ const [cmd, ...args] = process.argv.slice(2);
18
+ const script = COMMANDS[cmd];
19
+ if (!script) {
20
+ console.error(`usage: site-kit <${Object.keys(COMMANDS).join('|')}> [args]`);
21
+ process.exit(cmd ? 2 : 0);
22
+ }
23
+ const file = fileURLToPath(new URL(`../src/scripts/${script}`, import.meta.url));
24
+ process.exit(spawnSync(process.execPath, [file, ...args], { stdio: 'inherit' }).status ?? 1);
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@ninjainfosys/site-kit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Shared blog, glossary, SEO, layout and build tooling for the Ninja Infosys Astro marketing sites.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "repository": { "type": "git", "url": "https://git.ninjainfosys.com/ninja-infosys/site-kit.git" },
8
+ "exports": {
9
+ "./integration": { "types": "./src/integration.d.mts", "default": "./src/integration.mjs" },
10
+ "./contract": "./src/contract.ts",
11
+ "./config": "./src/config.ts",
12
+ "./components/*": "./src/components/*",
13
+ "./layouts/*": "./src/layouts/*",
14
+ "./lib/rehype-figures": "./src/lib/rehype-figures.mjs",
15
+ "./lib/*": "./src/lib/*.ts",
16
+ "./styles/*": "./src/styles/*",
17
+ "./pages/*": "./src/pages/*",
18
+ "./scripts/*": "./src/scripts/*",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "bin": { "site-kit": "bin/site-kit.mjs" },
22
+ "files": ["src", "bin"],
23
+ "engines": { "node": ">=20" },
24
+ "peerDependencies": {
25
+ "astro": "^5"
26
+ },
27
+ "dependencies": {
28
+ "@astrojs/rss": "^4",
29
+ "@fontsource-variable/inter": "5.2.8",
30
+ "@fontsource-variable/source-serif-4": "5.2.8",
31
+ "@fontsource/poppins": "^5",
32
+ "@lucide/astro": "1.53.0",
33
+ "@resvg/resvg-js": "^2",
34
+ "node-html-parser": "^7",
35
+ "satori": "^0.18",
36
+ "simple-icons": "16.34.0"
37
+ },
38
+ "optionalDependencies": {
39
+ "axe-core": "^4",
40
+ "puppeteer-core": "^24"
41
+ }
42
+ }
@@ -0,0 +1,60 @@
1
+ ---
2
+ import ArrowLeft from '@lucide/astro/icons/arrow-left';
3
+ import ArrowRight from '@lucide/astro/icons/arrow-right';
4
+ import { pagePath, pageWindow } from '../../lib/blog';
5
+ export interface Props { current: number; last: number }
6
+ const { current, last } = Astro.props;
7
+ const pages = pageWindow(current, last);
8
+ ---
9
+ {last > 1 && (
10
+ <nav class="pager" aria-label="Blog pages">
11
+ {current > 1
12
+ ? <a class="step" href={pagePath(current - 1)} rel="prev"><ArrowLeft size={18} aria-hidden="true" />Previous</a>
13
+ : <span class="step off" aria-hidden="true"><ArrowLeft size={18} />Previous</span>}
14
+ <ol>
15
+ {pages.map((n) =>
16
+ n === null ? (
17
+ <li class="gap" aria-hidden="true">…</li>
18
+ ) : n === current ? (
19
+ <li><span class="num on" aria-current="page">{n}</span></li>
20
+ ) : (
21
+ <li><a class="num" href={pagePath(n)} aria-label={`Page ${n}`}>{n}</a></li>
22
+ ),
23
+ )}
24
+ </ol>
25
+ <p class="where">{current} / {last}</p>
26
+ {current < last
27
+ ? <a class="step" href={pagePath(current + 1)} rel="next">Next<ArrowRight size={18} aria-hidden="true" /></a>
28
+ : <span class="step off" aria-hidden="true">Next<ArrowRight size={18} /></span>}
29
+ </nav>
30
+ )}
31
+
32
+ <style>
33
+ .pager {
34
+ display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
35
+ margin-top: var(--space-9);
36
+ }
37
+ ol { display: flex; align-items: center; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
38
+ .num, .step {
39
+ height: 44px; display: inline-flex; align-items: center; justify-content: center;
40
+ color: var(--ink-muted); text-decoration: none; font-size: 1rem;
41
+ transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
42
+ }
43
+ .num { min-width: 44px; border-radius: 999px; font-variant-numeric: tabular-nums; }
44
+ a.num:hover { color: var(--ink); background: var(--subtle); }
45
+ .num.on { color: var(--ink); background: var(--subtle); font-weight: 600; }
46
+ .step { gap: var(--space-2); color: var(--ink); font-weight: 500; }
47
+ .step :global(svg) { transition: transform var(--fast) var(--ease); }
48
+ a.step:hover { color: var(--brand); }
49
+ a.step[rel="prev"]:hover :global(svg) { transform: translateX(-3px); }
50
+ a.step[rel="next"]:hover :global(svg) { transform: translateX(3px); }
51
+ .step.off { visibility: hidden; }
52
+ .num:focus-visible, .step:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 999px; }
53
+ .gap { min-width: 24px; text-align: center; color: var(--ink-muted); }
54
+ .where { display: none; margin: 0; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
55
+
56
+ @media (max-width: 599px) {
57
+ ol { display: none; }
58
+ .where { display: block; }
59
+ }
60
+ </style>
@@ -0,0 +1,53 @@
1
+ ---
2
+ import { Image } from 'astro:assets';
3
+ import { fmtDate, type Post } from '../../lib/posts';
4
+ export interface Props { post: Post; big?: boolean; level?: 'h2' | 'h3' }
5
+ const { post, big = false, level = 'h2' } = Astro.props;
6
+ const d = post.data;
7
+ const H = level;
8
+ ---
9
+ <article class:list={['card', { big, pic: !!d.cover }]}>
10
+ {d.cover && (
11
+ <div class="thumb">
12
+ <Image src={d.cover} alt="" widths={big ? [600, 900, 1200] : [400, 600, 800]} sizes={big ? '(max-width: 900px) 100vw, 1200px' : '(max-width: 600px) 100vw, 400px'} loading={big ? 'eager' : 'lazy'} />
13
+ </div>
14
+ )}
15
+ <div class="text">
16
+ <H class="title"><a href={`/blog/${post.id}`}>{d.title}{d.draft && <span class="draft"> (draft)</span>}</a></H>
17
+ <span class="meta"><time datetime={d.date.toISOString()}>{fmtDate(d.date)}</time></span>
18
+ </div>
19
+ </article>
20
+
21
+ <style>
22
+ .card { position: relative; display: grid; gap: var(--space-4); align-content: start; padding-top: var(--space-5); border-top: 1px solid var(--line); height: 100%; }
23
+ .pic { padding-top: 0; border-top: 0; }
24
+ .thumb { overflow: hidden; border-radius: var(--radius-panel); background: var(--surface); aspect-ratio: 16 / 9; }
25
+ .thumb :global(img) { display: block; width: 100%; height: 100%; object-fit: cover; }
26
+ .text { display: grid; gap: var(--space-2); }
27
+ .title { font-size: 1.25rem; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
28
+ .title a { color: var(--ink); text-decoration: none; transition: color var(--fast) var(--ease); }
29
+ /* The whole card is one target through the title link. */
30
+ .title a::after { content: ''; position: absolute; inset: 0; }
31
+ .card:hover .title a { color: var(--link); }
32
+ .title a:focus-visible { outline: none; }
33
+ .card:has(.title a:focus-visible) { outline: 2px solid var(--brand); outline-offset: 6px; border-radius: var(--radius-panel); }
34
+ .meta { font-size: 14px; color: var(--ink-muted); }
35
+ .draft { color: var(--error); font-weight: 400; }
36
+ /* The newest post: a green panel, title large, nothing repeated. */
37
+ .big { padding: var(--space-8); border: 0; border-radius: var(--radius-panel); background: var(--stage); min-height: 300px; align-content: end; }
38
+ .big .title { font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.75rem); line-height: 1.15; max-width: 22ch; }
39
+ .big .title a { color: var(--stage-ink); }
40
+ .big:hover .title a { color: var(--stage-ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
41
+ .big .meta { color: var(--stage-muted); }
42
+ .big .text { gap: var(--space-3); }
43
+ /* With a cover, the newest post is the photo beside a green panel. */
44
+ .big.pic { padding: 0; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0; overflow: hidden; align-content: stretch; }
45
+ .big.pic .thumb { border-radius: 0; aspect-ratio: auto; min-height: 320px; }
46
+ .big.pic .text { padding: var(--space-7); align-content: end; }
47
+ @media (max-width: 899px) {
48
+ .big.pic { grid-template-columns: 1fr; }
49
+ .big.pic .thumb { aspect-ratio: 16 / 9; min-height: 0; }
50
+ .big.pic .text { padding: var(--space-6); }
51
+ }
52
+ @media (max-width: 599px) { .big { padding: var(--space-6); min-height: 240px; } .big.pic { padding: 0; } }
53
+ </style>
@@ -0,0 +1,21 @@
1
+ ---
2
+ import PostCard from './PostCard.astro';
3
+ import type { Post } from '../../lib/posts';
4
+ export interface Props { items: Post[]; feature?: boolean; level?: 'h2' | 'h3' }
5
+ const { items, feature = false, level = 'h2' } = Astro.props;
6
+ const [first, ...rest] = items;
7
+ const list = feature ? rest : items;
8
+ ---
9
+ {feature && first && <div class="top-post" data-enter><PostCard post={first} big level={level} /></div>}
10
+ {list.length > 0 && (
11
+ <ul class="grid">
12
+ {list.map((p, i) => <li data-enter style={`--d:${i + 1}`}><PostCard post={p} level={level} /></li>)}
13
+ </ul>
14
+ )}
15
+
16
+ <style>
17
+ .top-post { margin-bottom: var(--space-8); }
18
+ .grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-8) var(--space-6); }
19
+ @media (max-width: 959px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
20
+ @media (max-width: 599px) { .grid { grid-template-columns: 1fr; gap: var(--space-7); } }
21
+ </style>
@@ -0,0 +1,63 @@
1
+ ---
2
+ // One story on the blog front, in four sizes: `top` (the top story, big photo,
3
+ // headline and standfirst), `side` (beside the lead), `grid` (photo card) and
4
+ // `list` (headline only, numbered or plain). Every story shows a picture: its
5
+ // cover, else its generated share card.
6
+ import { Image } from 'astro:assets';
7
+ import { coverFor, fmtDate, readMinutes, type Post } from '../../lib/posts';
8
+ import { tagLabel } from '../../lib/blog';
9
+ export interface Props { post: Post; size: 'top' | 'side' | 'grid' | 'list'; level?: 'h2' | 'h3'; n?: number; eager?: boolean }
10
+ const { post, size, level = 'h3', n, eager = false } = Astro.props;
11
+ const d = post.data;
12
+ const H = level;
13
+ const href = `/blog/${post.id}`;
14
+ const widths = { top: [640, 960, 1280], side: [240, 360, 480], grid: [400, 600, 800], list: [] }[size];
15
+ const sizes = { top: '(max-width: 899px) 100vw, 760px', side: '120px', grid: '(max-width: 599px) 100vw, (max-width: 959px) 50vw, 300px', list: '' }[size];
16
+ ---
17
+ <article class:list={['story', size]}>
18
+ {size !== 'list' && (
19
+ <div class="pic">
20
+ {d.cover
21
+ ? <Image src={d.cover} alt="" widths={widths} sizes={sizes} loading={eager ? 'eager' : 'lazy'} fetchpriority={eager ? 'high' : undefined} />
22
+ : <img src={coverFor(post)} alt="" width="1200" height="630" loading={eager ? 'eager' : 'lazy'} />}
23
+ </div>
24
+ )}
25
+ {n !== undefined && <span class="n" aria-hidden="true">{n}</span>}
26
+ <div class="text">
27
+ <H class="h"><a href={href}>{d.title}</a></H>
28
+ {size === 'top' && <p class="dek">{d.description}</p>}
29
+ <p class="meta">
30
+ <time datetime={d.date.toISOString()}>{fmtDate(d.date)}</time>
31
+ {size !== 'side' && <> · {readMinutes(post)} min read</>}
32
+ {(size === 'top' || size === 'grid') && d.tags[0] && <> · {tagLabel(d.tags[0])}</>}
33
+ </p>
34
+ </div>
35
+ </article>
36
+
37
+ <style>
38
+ .story { position: relative; display: grid; gap: var(--space-3); align-content: start; }
39
+ .pic { overflow: hidden; border-radius: var(--radius-panel); background: var(--surface); aspect-ratio: 16 / 9; }
40
+ .pic img, .pic :global(img) { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity var(--fast) var(--ease); }
41
+ .story:hover .pic :global(img) { opacity: 0.9; }
42
+ .text { display: grid; gap: var(--space-2); }
43
+ .h { margin: 0; font-weight: 600; line-height: 1.2; text-wrap: balance; overflow-wrap: anywhere; }
44
+ .h a { color: var(--ink); text-decoration: none; }
45
+ /* The whole story is one target through its headline link. */
46
+ .h a::after { content: ''; position: absolute; inset: 0; }
47
+ .story:hover .h a { color: var(--link); }
48
+ .h a:focus-visible { outline: none; }
49
+ .story:has(.h a:focus-visible) { outline: 2px solid var(--brand); outline-offset: 6px; border-radius: var(--radius-panel); }
50
+ .meta { margin: 0; font-size: 14px; color: var(--ink-muted); }
51
+ .dek { margin: 0; font-size: 1.0625rem; line-height: 1.5; color: var(--ink-muted); max-width: 60ch; }
52
+
53
+ .top { gap: var(--space-4); }
54
+ .top .h { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.75rem); line-height: 1.12; }
55
+ .grid .h { font-size: 1.1875rem; }
56
+ .side { grid-template-columns: minmax(0, 1fr) 112px; gap: var(--space-4); padding-block: var(--space-4); border-top: 1px solid var(--line); }
57
+ .side .pic { order: 2; aspect-ratio: 1 / 1; }
58
+ .side .h { font-size: 1.0625rem; line-height: 1.3; }
59
+ .list { grid-template-columns: auto 1fr; gap: var(--space-4); padding-block: var(--space-4); border-top: 1px solid var(--line); }
60
+ .list:not(:has(.n)) { grid-template-columns: 1fr; }
61
+ .list .h { font-size: 1.0625rem; line-height: 1.3; }
62
+ .n { font-size: 2rem; font-weight: 600; line-height: 1; color: var(--link); min-width: 1.2em; }
63
+ </style>
@@ -0,0 +1,23 @@
1
+ ---
2
+ // Topic bar shared by the blog index and tag pages. The current topic is
3
+ // marked; "All" leads back to the full list.
4
+ import { tagLabel } from '../../lib/blog';
5
+ export interface Props { tags: string[]; current?: string }
6
+ const { tags, current } = Astro.props;
7
+ ---
8
+ <nav class="topics" aria-label="Topics">
9
+ <a href="/blog" aria-current={!current ? 'page' : undefined}>All</a>
10
+ {tags.map((t) => <a href={`/blog/tag/${t}`} aria-current={current === t ? 'page' : undefined}>{tagLabel(t)}</a>)}
11
+ </nav>
12
+
13
+ <style>
14
+ .topics { display: flex; gap: var(--space-5); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: var(--space-8); }
15
+ .topics::-webkit-scrollbar { display: none; }
16
+ .topics a {
17
+ flex: none; display: inline-flex; align-items: center; min-height: 48px; margin-bottom: -1px;
18
+ color: var(--ink-muted); text-decoration: none; font-size: 16px; font-weight: 500; white-space: nowrap;
19
+ border-bottom: 2px solid transparent; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
20
+ }
21
+ .topics a:hover { color: var(--ink); }
22
+ .topics a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--brand); }
23
+ </style>
@@ -0,0 +1,46 @@
1
+ ---
2
+ import { abs, canonicalFor, orgJsonLd, titleFor, websiteJsonLd } from '../../lib/seo';
3
+ import { SITE_NAME, kit } from '../../config';
4
+
5
+ export interface Props {
6
+ title?: string;
7
+ description: string;
8
+ path: string;
9
+ image?: string;
10
+ imageAlt?: string;
11
+ type?: 'website' | 'article';
12
+ noindex?: boolean;
13
+ jsonLd?: object[];
14
+ published?: Date;
15
+ modified?: Date;
16
+ }
17
+
18
+ const { title, description, path, image, imageAlt, type = 'website', noindex = false, jsonLd = [], published, modified } = Astro.props;
19
+ const fullTitle = titleFor(title);
20
+ const canonical = canonicalFor(path);
21
+ const ogPath = image ?? `/og${path === '/' ? '/index' : path}.png`;
22
+ const ogImage = abs(ogPath);
23
+ const graph = [orgJsonLd(), websiteJsonLd(), ...jsonLd];
24
+ ---
25
+ <title>{fullTitle}</title>
26
+ <meta name="description" content={description} />
27
+ <link rel="canonical" href={canonical} />
28
+ {!noindex && <><link rel="alternate" hreflang={kit.seo.hreflang} href={canonical} /><link rel="alternate" hreflang="x-default" href={canonical} /></>}
29
+ {noindex && <meta name="robots" content="noindex, follow" />}
30
+ <meta property="og:site_name" content={SITE_NAME} />
31
+ <meta property="og:type" content={type} />
32
+ <meta property="og:title" content={fullTitle} />
33
+ <meta property="og:description" content={description} />
34
+ <meta property="og:url" content={canonical} />
35
+ <meta property="og:image" content={ogImage} />
36
+ <meta property="og:image:width" content="1200" />
37
+ <meta property="og:image:height" content="630" />
38
+ <meta property="og:image:alt" content={imageAlt ?? fullTitle} />
39
+ <meta property="og:locale" content={kit.seo.ogLocale} />
40
+ {published && <meta property="article:published_time" content={published.toISOString()} />}
41
+ {modified && <meta property="article:modified_time" content={modified.toISOString()} />}
42
+ <meta name="twitter:card" content="summary_large_image" />
43
+ <meta name="twitter:title" content={fullTitle} />
44
+ <meta name="twitter:description" content={description} />
45
+ <meta name="twitter:image" content={ogImage} />
46
+ <script type="application/ld+json" set:html={JSON.stringify(graph)} />
@@ -0,0 +1,21 @@
1
+ ---
2
+ import { kit } from '../../config';
3
+ export interface Props { heading?: string }
4
+ const { heading = kit.cta.heading } = Astro.props;
5
+ ---
6
+ <section class="cta on-stage">
7
+ <div class="wrap inner">
8
+ <h2>{heading}</h2>
9
+ <div class="actions">
10
+ {kit.cta.actions.map((a, i) => <>{i > 0 && ' '}<a class={`btn ${a.class}`} href={a.href}>{a.label}</a></>)}
11
+ </div>
12
+ </div>
13
+ </section>
14
+
15
+ <style>
16
+ .cta { padding-block: var(--space-9); }
17
+ h2 { color: var(--stage-ink); }
18
+ .inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; }
19
+ h2 { max-width: 18ch; }
20
+ .actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
21
+ </style>