@sarimarcus/content-sites-ui 0.54.2 → 0.55.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/CHANGELOG.md +4 -0
- package/README.md +5 -1
- package/package.json +2 -2
- package/src/editorial/AuthorPage.astro +292 -0
- package/src/editorial/AuthorsIndexPage.astro +127 -0
- package/src/editorial/author-page.ts +113 -0
- package/src/editorial/index.ts +11 -0
- package/src/internal/labels.ts +44 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.55.0 (2026-11-04)
|
|
6
|
+
|
|
7
|
+
- `editorial`: add `AuthorPage`, `AuthorsIndexPage`, `groupAuthorWork`, and `socialLinkLabel` (with `authorPage` and `authorsIndexPage` labels in `LABELS` and `LABELS_IT`) — solid `bg-muted` header band, `BreadcrumbBand`, `ResponsiveImage` portrait (`sizes` + `fetchpriority="high"`), solid `bg-accent` rule, and slots/props for expertise chips, credentials, social links, grouped work with "Show N more" disclosure, topic hubs, editorial prose, author cards, and FAQ (SLA-3756).
|
|
8
|
+
|
|
5
9
|
## 0.54.2 (2026-11-03)
|
|
6
10
|
|
|
7
11
|
- `internal/labels`, `editorial`, `affiliate`, `layout`, `navigation`, `seo`: add `LABELS_IT`, `LABELS_BY_LOCALE`, and `getLabels(locale)` with automatic `Astro.currentLocale` / `locale` resolution across UI components, `it`/`es`/`de` number formatting locales in `cardItem`, and guillemet quotes (`«…»`) + foreign `lang` tagging in `AuthoritativeSources` (SLA-3787).
|
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ state and one bundled controller (idempotent on `astro:page-load`, any number of
|
|
|
89
89
|
## Page templates
|
|
90
90
|
|
|
91
91
|
```ts
|
|
92
|
-
import { StaticProsePage, NotFoundPage, ArticlesListingPage, ArticleFeatureCard } from '@sarimarcus/content-sites-ui/editorial';
|
|
92
|
+
import { StaticProsePage, NotFoundPage, ArticlesListingPage, ArticleFeatureCard, AuthorPage, AuthorsIndexPage, groupAuthorWork } from '@sarimarcus/content-sites-ui/editorial';
|
|
93
93
|
import { EntityDetailShell, ListingShell } from '@sarimarcus/content-sites-ui/layout';
|
|
94
94
|
```
|
|
95
95
|
|
|
@@ -101,6 +101,10 @@ prose stay in the route so the site's link and outbound-domain scanners still se
|
|
|
101
101
|
`cta` box. Carries no Pagefind body.
|
|
102
102
|
- `NotFoundPage`: the 404 body; the route passes `noindex` to Layout and imports `@sarimarcus/content-sites-ui/not-found.css`.
|
|
103
103
|
- `ArticlesListingPage` / `ArticleFeatureCard`: article index, topic hubs and their paginated pages.
|
|
104
|
+
- `AuthorPage` / `AuthorsIndexPage`: the author profile (`/author/<slug>`) and the authors directory (`/authors`).
|
|
105
|
+
Solid `bg-muted` header band, solid `bg-accent` rule, portrait rendered through `ResponsiveImage` with `sizes` and
|
|
106
|
+
`fetchpriority="high"`; `groupAuthorWork` buckets, sorts and caps an author's entries per topic and produces the
|
|
107
|
+
published-work rows and topic chips.
|
|
104
108
|
- `ArticleTopicPage`: the body of `/articles/topic/<category>` and its paginated pages, around the topic nav. Blocks
|
|
105
109
|
the site renders through its own adapters arrive as slots: `start-here`, `grid`, `pagination`, `go-deeper`,
|
|
106
110
|
`places`, `faq` (wrapped in a measure column only when filled), plus `breadcrumb`, `header-extra` and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.0",
|
|
4
4
|
"description": "Universal Astro UI components, layout shell and design tokens shared by the content sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
"@lucide/astro": "^1.23.0",
|
|
51
51
|
"astro": "^7.0.6",
|
|
52
52
|
"tailwindcss": "^4.1.18",
|
|
53
|
-
"@sarimarcus/content-sites-core": "0.
|
|
53
|
+
"@sarimarcus/content-sites-core": "0.55.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ImageMetadata } from 'astro';
|
|
3
|
+
import Container from '../layout/Container.astro';
|
|
4
|
+
import BreadcrumbBand from '../layout/BreadcrumbBand.astro';
|
|
5
|
+
import ResponsiveImage from '../primitives/ResponsiveImage.astro';
|
|
6
|
+
import Chip from '../primitives/Chip.astro';
|
|
7
|
+
import RoleBadge from './RoleBadge.astro';
|
|
8
|
+
import Icon from '../primitives/Icon.astro';
|
|
9
|
+
import { getLabels } from '../internal/labels';
|
|
10
|
+
import { socialLinkLabel, type AuthorWorkItem, type AuthorTopicLink } from './author-page';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
name: string;
|
|
14
|
+
role?: string;
|
|
15
|
+
roleClass?: string;
|
|
16
|
+
bio: string;
|
|
17
|
+
credentials?: string;
|
|
18
|
+
credentialsHeading?: string;
|
|
19
|
+
expertise?: string[];
|
|
20
|
+
expertiseLinks?: Record<string, string>;
|
|
21
|
+
expertiseFallbackHref?: string;
|
|
22
|
+
sameAs?: string[];
|
|
23
|
+
portrait?: ImageMetadata | string;
|
|
24
|
+
portraitAlt?: string;
|
|
25
|
+
statsLine?: string;
|
|
26
|
+
totalItems?: number;
|
|
27
|
+
topicCount?: number;
|
|
28
|
+
statsNoun?: { one: string; many: string };
|
|
29
|
+
workItems?: AuthorWorkItem[];
|
|
30
|
+
topicLinks?: AuthorTopicLink[];
|
|
31
|
+
initialWorkCount?: number;
|
|
32
|
+
workHeading?: string;
|
|
33
|
+
workSubtitle?: string;
|
|
34
|
+
showMoreLabel?: (remaining: number) => string;
|
|
35
|
+
topicsHeading?: string;
|
|
36
|
+
emptyHeading?: string;
|
|
37
|
+
emptyBody?: string;
|
|
38
|
+
locale?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const {
|
|
42
|
+
name,
|
|
43
|
+
role,
|
|
44
|
+
roleClass = 'text-sm font-semibold uppercase tracking-[0.18em] text-primary mb-3',
|
|
45
|
+
bio,
|
|
46
|
+
credentials,
|
|
47
|
+
credentialsHeading,
|
|
48
|
+
expertise = [],
|
|
49
|
+
expertiseLinks,
|
|
50
|
+
expertiseFallbackHref,
|
|
51
|
+
sameAs = [],
|
|
52
|
+
portrait,
|
|
53
|
+
portraitAlt,
|
|
54
|
+
statsLine,
|
|
55
|
+
totalItems = 0,
|
|
56
|
+
topicCount = 0,
|
|
57
|
+
statsNoun,
|
|
58
|
+
workItems = [],
|
|
59
|
+
topicLinks = [],
|
|
60
|
+
initialWorkCount = 24,
|
|
61
|
+
workHeading,
|
|
62
|
+
workSubtitle,
|
|
63
|
+
showMoreLabel,
|
|
64
|
+
topicsHeading,
|
|
65
|
+
emptyHeading,
|
|
66
|
+
emptyBody,
|
|
67
|
+
locale,
|
|
68
|
+
} = Astro.props;
|
|
69
|
+
|
|
70
|
+
const d = getLabels(locale).authorPage;
|
|
71
|
+
const resolvedRole = role ?? d.roleEyebrow;
|
|
72
|
+
const resolvedPortraitAlt = portraitAlt ?? d.portraitAlt(name);
|
|
73
|
+
const resolvedCredentialsHeading = credentialsHeading ?? d.credentialsHeading;
|
|
74
|
+
const resolvedStatsLine =
|
|
75
|
+
statsLine ?? (totalItems > 0 ? d.statsLine(totalItems, topicCount, statsNoun) : undefined);
|
|
76
|
+
const effectiveTotal = totalItems > 0 ? totalItems : workItems.length;
|
|
77
|
+
const resolvedWorkHeading = workHeading ?? d.workHeading;
|
|
78
|
+
const resolvedWorkSubtitle = workSubtitle ?? d.workSubtitle(effectiveTotal);
|
|
79
|
+
const resolvedShowMore = (showMoreLabel ?? d.showMore)(
|
|
80
|
+
Math.max(0, workItems.length - initialWorkCount),
|
|
81
|
+
);
|
|
82
|
+
const resolvedTopicsHeading = topicsHeading ?? d.topicsHeading;
|
|
83
|
+
const resolvedEmptyHeading = emptyHeading ?? d.emptyHeading;
|
|
84
|
+
const resolvedEmptyBody = emptyBody ?? d.emptyBody(name);
|
|
85
|
+
const hasExpertiseSlot = Astro.slots.has('expertise');
|
|
86
|
+
const hasWorksSlot = Astro.slots.has('works');
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
<div class="bg-muted border-b border-border" data-pagefind-body>
|
|
90
|
+
<BreadcrumbBand ignore={false} class="pt-16">
|
|
91
|
+
<slot name="breadcrumb" />
|
|
92
|
+
</BreadcrumbBand>
|
|
93
|
+
<header class="pt-10 pb-12">
|
|
94
|
+
<Container>
|
|
95
|
+
<div
|
|
96
|
+
class:list={[
|
|
97
|
+
'grid grid-cols-1 gap-8 items-start',
|
|
98
|
+
portrait && 'md:grid-cols-[200px_1fr] lg:grid-cols-[220px_1fr] lg:gap-12',
|
|
99
|
+
]}
|
|
100
|
+
>
|
|
101
|
+
{portrait && (
|
|
102
|
+
<div class="w-40 sm:w-48 md:w-full">
|
|
103
|
+
<ResponsiveImage
|
|
104
|
+
src={portrait}
|
|
105
|
+
alt={resolvedPortraitAlt}
|
|
106
|
+
width={400}
|
|
107
|
+
height={400}
|
|
108
|
+
sizes="(min-width: 1024px) 220px, (min-width: 640px) 192px, 160px"
|
|
109
|
+
class="aspect-square w-full rounded-xl object-cover bg-muted"
|
|
110
|
+
loading="eager"
|
|
111
|
+
fetchpriority="high"
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
)}
|
|
115
|
+
<div>
|
|
116
|
+
<p class={roleClass}>
|
|
117
|
+
{resolvedRole}
|
|
118
|
+
</p>
|
|
119
|
+
<h1 class="text-4xl sm:text-5xl font-bold font-display text-foreground leading-tight">
|
|
120
|
+
{name}
|
|
121
|
+
</h1>
|
|
122
|
+
<div class="mt-4 flex">
|
|
123
|
+
<span class="block h-0.5 w-16 rounded-full bg-accent"></span>
|
|
124
|
+
</div>
|
|
125
|
+
<p class="mt-5 max-w-measure text-lg text-muted-foreground leading-relaxed">
|
|
126
|
+
{bio}
|
|
127
|
+
</p>
|
|
128
|
+
|
|
129
|
+
{credentials && (
|
|
130
|
+
<div class="mt-6 max-w-measure rounded-xl border border-border bg-card/70 p-4">
|
|
131
|
+
<p class="text-xs font-semibold uppercase tracking-[0.16em] text-primary mb-1.5">
|
|
132
|
+
{resolvedCredentialsHeading}
|
|
133
|
+
</p>
|
|
134
|
+
<p class="text-sm text-muted-foreground leading-relaxed">
|
|
135
|
+
{credentials}
|
|
136
|
+
</p>
|
|
137
|
+
</div>
|
|
138
|
+
)}
|
|
139
|
+
|
|
140
|
+
{hasExpertiseSlot ? (
|
|
141
|
+
<slot name="expertise" />
|
|
142
|
+
) : (
|
|
143
|
+
expertise.length > 0 && (
|
|
144
|
+
<div class="mt-6 flex flex-wrap gap-2">
|
|
145
|
+
{expertise.map((topic) => {
|
|
146
|
+
const href = expertiseLinks?.[topic.toLowerCase()] ?? expertiseFallbackHref;
|
|
147
|
+
return href ? (
|
|
148
|
+
<Chip href={href} size="sm" text="sm" tone="outline">
|
|
149
|
+
{topic}
|
|
150
|
+
</Chip>
|
|
151
|
+
) : (
|
|
152
|
+
<RoleBadge>{topic}</RoleBadge>
|
|
153
|
+
);
|
|
154
|
+
})}
|
|
155
|
+
</div>
|
|
156
|
+
)
|
|
157
|
+
)}
|
|
158
|
+
|
|
159
|
+
{sameAs.length > 0 && (
|
|
160
|
+
<div class="mt-6 flex flex-wrap items-center gap-3">
|
|
161
|
+
{sameAs.map((href) => (
|
|
162
|
+
<a
|
|
163
|
+
href={href}
|
|
164
|
+
target="_blank"
|
|
165
|
+
rel="noopener noreferrer"
|
|
166
|
+
class="inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:text-primary-strong transition-colors"
|
|
167
|
+
>
|
|
168
|
+
<span>{socialLinkLabel(href)}</span>
|
|
169
|
+
<Icon name="external-link" class="w-3.5 h-3.5" />
|
|
170
|
+
</a>
|
|
171
|
+
))}
|
|
172
|
+
</div>
|
|
173
|
+
)}
|
|
174
|
+
|
|
175
|
+
{resolvedStatsLine && (
|
|
176
|
+
<p class="mt-6 text-sm text-muted-foreground">
|
|
177
|
+
{resolvedStatsLine}
|
|
178
|
+
</p>
|
|
179
|
+
)}
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
</Container>
|
|
183
|
+
</header>
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<main class="py-12">
|
|
187
|
+
<Container>
|
|
188
|
+
{hasWorksSlot ? (
|
|
189
|
+
<slot name="works" />
|
|
190
|
+
) : workItems.length > 0 ? (
|
|
191
|
+
<section data-author-work data-work-preview={initialWorkCount}>
|
|
192
|
+
<div class="mb-6">
|
|
193
|
+
<h2 class="text-2xl sm:text-3xl font-bold font-display text-foreground">
|
|
194
|
+
{resolvedWorkHeading}
|
|
195
|
+
</h2>
|
|
196
|
+
<p class="mt-1 text-sm text-muted-foreground">
|
|
197
|
+
{resolvedWorkSubtitle}
|
|
198
|
+
</p>
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
<ul class="divide-y divide-border rounded-xl border border-border bg-card overflow-hidden">
|
|
202
|
+
{workItems.map((item) => (
|
|
203
|
+
<li data-work-row>
|
|
204
|
+
<a
|
|
205
|
+
href={item.href}
|
|
206
|
+
class="group flex items-baseline justify-between gap-6 px-5 py-4 hover:bg-muted/40 transition-colors"
|
|
207
|
+
>
|
|
208
|
+
<div class="min-w-0 flex-1">
|
|
209
|
+
<div class="flex flex-wrap items-baseline gap-x-3 gap-y-1">
|
|
210
|
+
<h3 class="text-base sm:text-lg font-semibold font-display text-foreground group-hover:text-primary transition-colors">
|
|
211
|
+
{item.title}
|
|
212
|
+
</h3>
|
|
213
|
+
<span class="text-xs font-medium text-muted-foreground">
|
|
214
|
+
{item.kind}
|
|
215
|
+
</span>
|
|
216
|
+
</div>
|
|
217
|
+
{item.description && (
|
|
218
|
+
<p class="mt-1 text-sm text-muted-foreground line-clamp-1">
|
|
219
|
+
{item.description}
|
|
220
|
+
</p>
|
|
221
|
+
)}
|
|
222
|
+
</div>
|
|
223
|
+
<Icon
|
|
224
|
+
name="arrow-right"
|
|
225
|
+
class="w-4 h-4 shrink-0 text-muted-foreground group-hover:text-primary group-hover:translate-x-0.5 transition-all"
|
|
226
|
+
/>
|
|
227
|
+
</a>
|
|
228
|
+
</li>
|
|
229
|
+
))}
|
|
230
|
+
</ul>
|
|
231
|
+
|
|
232
|
+
{workItems.length > initialWorkCount && (
|
|
233
|
+
<div class="mt-6 text-center">
|
|
234
|
+
<Chip type="button" data-work-more tone="outline" size="md" class="px-5" hidden>
|
|
235
|
+
{resolvedShowMore}
|
|
236
|
+
</Chip>
|
|
237
|
+
</div>
|
|
238
|
+
)}
|
|
239
|
+
|
|
240
|
+
{topicLinks.length > 0 && (
|
|
241
|
+
<div class="mt-10">
|
|
242
|
+
<p class="text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground mb-3">
|
|
243
|
+
{resolvedTopicsHeading}
|
|
244
|
+
</p>
|
|
245
|
+
<div class="flex flex-wrap gap-2">
|
|
246
|
+
{topicLinks.map((g) => (
|
|
247
|
+
<Chip href={g.href} tone="outline" size="md">
|
|
248
|
+
{g.label}
|
|
249
|
+
</Chip>
|
|
250
|
+
))}
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
)}
|
|
254
|
+
</section>
|
|
255
|
+
) : (
|
|
256
|
+
<div class="text-center py-12 bg-muted/30 rounded-xl border border-border">
|
|
257
|
+
<p class="text-lg font-medium text-foreground mb-2">{resolvedEmptyHeading}</p>
|
|
258
|
+
<p class="text-muted-foreground">{resolvedEmptyBody}</p>
|
|
259
|
+
</div>
|
|
260
|
+
)}
|
|
261
|
+
</Container>
|
|
262
|
+
</main>
|
|
263
|
+
|
|
264
|
+
<script>
|
|
265
|
+
function initAuthorWork() {
|
|
266
|
+
document
|
|
267
|
+
.querySelectorAll<HTMLElement>('[data-author-work]:not([data-author-work-ready])')
|
|
268
|
+
.forEach((root) => {
|
|
269
|
+
root.setAttribute('data-author-work-ready', '');
|
|
270
|
+
const preview = Number(root.dataset.workPreview ?? 24);
|
|
271
|
+
const rows = root.querySelectorAll<HTMLElement>('[data-work-row]');
|
|
272
|
+
const more = root.querySelector<HTMLButtonElement>('[data-work-more]');
|
|
273
|
+
if (!more || rows.length <= preview) return;
|
|
274
|
+
rows.forEach((row, idx) => {
|
|
275
|
+
if (idx >= preview) row.hidden = true;
|
|
276
|
+
});
|
|
277
|
+
more.hidden = false;
|
|
278
|
+
more.addEventListener(
|
|
279
|
+
'click',
|
|
280
|
+
() => {
|
|
281
|
+
rows.forEach((row) => {
|
|
282
|
+
row.hidden = false;
|
|
283
|
+
});
|
|
284
|
+
more.remove();
|
|
285
|
+
},
|
|
286
|
+
{ once: true },
|
|
287
|
+
);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
initAuthorWork();
|
|
291
|
+
document.addEventListener('astro:page-load', initAuthorWork);
|
|
292
|
+
</script>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Container from '../layout/Container.astro';
|
|
3
|
+
import BreadcrumbBand from '../layout/BreadcrumbBand.astro';
|
|
4
|
+
import Button from '../primitives/Button.astro';
|
|
5
|
+
import { getLabels } from '../internal/labels';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
eyebrow?: string;
|
|
9
|
+
heading?: string;
|
|
10
|
+
lede: string;
|
|
11
|
+
contributorsCount: number;
|
|
12
|
+
contributorsLabel?: string;
|
|
13
|
+
entriesCount: number | string;
|
|
14
|
+
entriesLabel?: string;
|
|
15
|
+
closerHeading: string;
|
|
16
|
+
closerBody: string;
|
|
17
|
+
aboutHref: string;
|
|
18
|
+
aboutLabel?: string;
|
|
19
|
+
standardsHref: string;
|
|
20
|
+
standardsLabel?: string;
|
|
21
|
+
proseClass?: string;
|
|
22
|
+
locale?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
eyebrow,
|
|
27
|
+
heading,
|
|
28
|
+
lede,
|
|
29
|
+
contributorsCount,
|
|
30
|
+
contributorsLabel,
|
|
31
|
+
entriesCount,
|
|
32
|
+
entriesLabel,
|
|
33
|
+
closerHeading,
|
|
34
|
+
closerBody,
|
|
35
|
+
aboutHref,
|
|
36
|
+
aboutLabel,
|
|
37
|
+
standardsHref,
|
|
38
|
+
standardsLabel,
|
|
39
|
+
proseClass = 'prose prose-stone max-w-none',
|
|
40
|
+
locale,
|
|
41
|
+
} = Astro.props;
|
|
42
|
+
|
|
43
|
+
const d = getLabels(locale).authorsIndexPage;
|
|
44
|
+
const resolvedEyebrow = eyebrow ?? d.eyebrow;
|
|
45
|
+
const resolvedHeading = heading ?? d.heading;
|
|
46
|
+
const resolvedContributorsLabel = contributorsLabel ?? d.contributorsLabel;
|
|
47
|
+
const resolvedEntriesLabel = entriesLabel ?? d.entriesLabel;
|
|
48
|
+
const resolvedAboutLabel = aboutLabel ?? d.aboutLabel;
|
|
49
|
+
const resolvedStandardsLabel = standardsLabel ?? d.standardsLabel;
|
|
50
|
+
const hasProse = Astro.slots.has('default');
|
|
51
|
+
const hasFaq = Astro.slots.has('faq');
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
<div class="bg-muted border-b border-border" data-pagefind-body>
|
|
55
|
+
<BreadcrumbBand ignore={false} class="pt-16">
|
|
56
|
+
<slot name="breadcrumb" />
|
|
57
|
+
</BreadcrumbBand>
|
|
58
|
+
<header class="pt-12 pb-12">
|
|
59
|
+
<Container>
|
|
60
|
+
<p class="text-sm font-semibold uppercase tracking-[0.18em] text-primary mb-3">
|
|
61
|
+
{resolvedEyebrow}
|
|
62
|
+
</p>
|
|
63
|
+
<h1 class="text-4xl sm:text-5xl font-bold font-display text-foreground leading-tight">
|
|
64
|
+
{resolvedHeading}
|
|
65
|
+
</h1>
|
|
66
|
+
<div class="mt-4 flex">
|
|
67
|
+
<span class="block h-0.5 w-16 rounded-full bg-accent"></span>
|
|
68
|
+
</div>
|
|
69
|
+
<p class="mt-5 max-w-measure text-lg text-muted-foreground leading-relaxed">
|
|
70
|
+
{lede}
|
|
71
|
+
</p>
|
|
72
|
+
|
|
73
|
+
<div class="mt-8 flex flex-wrap gap-6 sm:gap-10">
|
|
74
|
+
<div>
|
|
75
|
+
<p class="text-2xl sm:text-3xl font-bold font-display text-foreground">
|
|
76
|
+
{contributorsCount}
|
|
77
|
+
</p>
|
|
78
|
+
<p class="text-xs font-medium uppercase tracking-[0.14em] text-muted-foreground mt-0.5">
|
|
79
|
+
{resolvedContributorsLabel}
|
|
80
|
+
</p>
|
|
81
|
+
</div>
|
|
82
|
+
<div>
|
|
83
|
+
<p class="text-2xl sm:text-3xl font-bold font-display text-foreground">
|
|
84
|
+
{entriesCount}
|
|
85
|
+
</p>
|
|
86
|
+
<p class="text-xs font-medium uppercase tracking-[0.14em] text-muted-foreground mt-0.5">
|
|
87
|
+
{resolvedEntriesLabel}
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</Container>
|
|
92
|
+
</header>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<main class="py-12">
|
|
96
|
+
<Container size="measure">
|
|
97
|
+
{hasProse && (
|
|
98
|
+
<div class:list={[proseClass, 'mb-14']}>
|
|
99
|
+
<slot />
|
|
100
|
+
</div>
|
|
101
|
+
)}
|
|
102
|
+
<div class="mb-16">
|
|
103
|
+
<slot name="cards" />
|
|
104
|
+
</div>
|
|
105
|
+
{hasFaq && (
|
|
106
|
+
<div class="mb-16">
|
|
107
|
+
<slot name="faq" />
|
|
108
|
+
</div>
|
|
109
|
+
)}
|
|
110
|
+
<div class="rounded-2xl border border-border bg-muted/40 p-6 sm:p-8">
|
|
111
|
+
<h2 class="text-xl sm:text-2xl font-bold font-display text-foreground">
|
|
112
|
+
{closerHeading}
|
|
113
|
+
</h2>
|
|
114
|
+
<p class="mt-2 text-sm sm:text-base text-muted-foreground leading-relaxed">
|
|
115
|
+
{closerBody}
|
|
116
|
+
</p>
|
|
117
|
+
<div class="mt-4 flex flex-wrap gap-3">
|
|
118
|
+
<Button href={aboutHref} variant="secondary">
|
|
119
|
+
{resolvedAboutLabel}
|
|
120
|
+
</Button>
|
|
121
|
+
<Button href={standardsHref} variant="secondary">
|
|
122
|
+
{resolvedStandardsLabel}
|
|
123
|
+
</Button>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</Container>
|
|
127
|
+
</main>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export interface AuthorWorkItem {
|
|
2
|
+
title: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
/** Profile or entity href, base path already applied. */
|
|
5
|
+
href: string;
|
|
6
|
+
/** Singular label shown on the row (e.g. 'Monument', 'Guide & Article'). */
|
|
7
|
+
kind: string;
|
|
8
|
+
dateModified?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AuthorTopicLink {
|
|
12
|
+
label: string;
|
|
13
|
+
/** Listing href, base path already applied. */
|
|
14
|
+
href: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface AuthorWorkGroupConfig {
|
|
18
|
+
collection: string;
|
|
19
|
+
label: string;
|
|
20
|
+
kind: string;
|
|
21
|
+
listing?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface AuthorRawItem {
|
|
25
|
+
collection: string;
|
|
26
|
+
title: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
href: string;
|
|
29
|
+
dateModified?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface GroupedAuthorWork {
|
|
33
|
+
workItems: AuthorWorkItem[];
|
|
34
|
+
topicLinks: AuthorTopicLink[];
|
|
35
|
+
totalItems: number;
|
|
36
|
+
topicCount: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Readable label for a social/profile URL in author `sameAs` links. */
|
|
40
|
+
export function socialLinkLabel(url: string): string {
|
|
41
|
+
try {
|
|
42
|
+
const host = new URL(url).hostname.replace(/^www\./, '');
|
|
43
|
+
if (host.includes('linkedin')) return 'LinkedIn';
|
|
44
|
+
if (host.includes('twitter') || host.includes('x.com')) return 'X';
|
|
45
|
+
if (host.includes('instagram')) return 'Instagram';
|
|
46
|
+
if (host.includes('pinterest')) return 'Pinterest';
|
|
47
|
+
if (host.includes('academia')) return 'Academia.edu';
|
|
48
|
+
if (host.includes('researchgate')) return 'ResearchGate';
|
|
49
|
+
return host;
|
|
50
|
+
} catch {
|
|
51
|
+
return 'Profile';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Group an author's raw items by `configs` order (also matching `static:${cfg.label}`), sort each
|
|
57
|
+
* bucket newest-first by `dateModified` (then alphabetically by `title`), cap each bucket at
|
|
58
|
+
* `perTypeCap` (default 15), and return the flattened `workItems` list (optionally re-sorted across
|
|
59
|
+
* all buckets when `sortAll` is true), the populated `topicLinks`, `totalItems` (uncapped), and
|
|
60
|
+
* `topicCount`.
|
|
61
|
+
*/
|
|
62
|
+
export function groupAuthorWork(
|
|
63
|
+
items: readonly AuthorRawItem[],
|
|
64
|
+
configs: readonly AuthorWorkGroupConfig[],
|
|
65
|
+
options?: { perTypeCap?: number; mapHref?: (href: string) => string; sortAll?: boolean },
|
|
66
|
+
): GroupedAuthorWork {
|
|
67
|
+
const cap = options?.perTypeCap ?? 15;
|
|
68
|
+
const mapHref = options?.mapHref ?? ((h: string) => h);
|
|
69
|
+
const byRecency = (
|
|
70
|
+
a: { title: string; dateModified?: string },
|
|
71
|
+
b: { title: string; dateModified?: string },
|
|
72
|
+
) =>
|
|
73
|
+
(b.dateModified || '').localeCompare(a.dateModified || '') ||
|
|
74
|
+
a.title.localeCompare(b.title);
|
|
75
|
+
const workItems: AuthorWorkItem[] = [];
|
|
76
|
+
const topicLinks: AuthorTopicLink[] = [];
|
|
77
|
+
let topicCount = 0;
|
|
78
|
+
|
|
79
|
+
for (const cfg of configs) {
|
|
80
|
+
const bucket = items.filter(
|
|
81
|
+
(item) => item.collection === cfg.collection || item.collection === `static:${cfg.label}`,
|
|
82
|
+
);
|
|
83
|
+
if (bucket.length === 0) continue;
|
|
84
|
+
topicCount += 1;
|
|
85
|
+
const sorted = [...bucket].sort(byRecency);
|
|
86
|
+
for (const item of sorted.slice(0, cap)) {
|
|
87
|
+
workItems.push({
|
|
88
|
+
title: item.title,
|
|
89
|
+
description: item.description,
|
|
90
|
+
href: mapHref(item.href),
|
|
91
|
+
kind: cfg.kind,
|
|
92
|
+
dateModified: item.dateModified,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (cfg.listing) {
|
|
96
|
+
topicLinks.push({
|
|
97
|
+
label: cfg.label,
|
|
98
|
+
href: mapHref(cfg.listing),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (options?.sortAll) {
|
|
104
|
+
workItems.sort(byRecency);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
workItems,
|
|
109
|
+
topicLinks,
|
|
110
|
+
totalItems: items.length,
|
|
111
|
+
topicCount,
|
|
112
|
+
};
|
|
113
|
+
}
|
package/src/editorial/index.ts
CHANGED
|
@@ -68,3 +68,14 @@ export { default as DossierSection } from './DossierSection.astro';
|
|
|
68
68
|
export { groupDossier, type DossierEntry, type DossierGroup } from './dossier';
|
|
69
69
|
export { default as EraListingRoute } from './EraListingRoute.astro';
|
|
70
70
|
export { buildEraListing, type EraListingInput, type EraListingModel } from './era-listing';
|
|
71
|
+
export { default as AuthorPage } from './AuthorPage.astro';
|
|
72
|
+
export { default as AuthorsIndexPage } from './AuthorsIndexPage.astro';
|
|
73
|
+
export {
|
|
74
|
+
socialLinkLabel,
|
|
75
|
+
groupAuthorWork,
|
|
76
|
+
type AuthorWorkItem,
|
|
77
|
+
type AuthorTopicLink,
|
|
78
|
+
type AuthorWorkGroupConfig,
|
|
79
|
+
type AuthorRawItem,
|
|
80
|
+
type GroupedAuthorWork,
|
|
81
|
+
} from './author-page';
|
package/src/internal/labels.ts
CHANGED
|
@@ -182,6 +182,28 @@ export const LABELS = {
|
|
|
182
182
|
pageLabel: (page: number) => `Page ${page}`,
|
|
183
183
|
timelineLink: (era: string) => `See ${era} on the timeline, with its people and monuments`,
|
|
184
184
|
},
|
|
185
|
+
authorPage: {
|
|
186
|
+
roleEyebrow: 'Editorial Contributor',
|
|
187
|
+
portraitAlt: (name: string) => `Portrait of ${name}`,
|
|
188
|
+
credentialsHeading: 'Credentials',
|
|
189
|
+
statsLine: (items: number, topics: number, noun?: { one: string; many: string }) =>
|
|
190
|
+
`${items} ${items === 1 ? (noun?.one ?? 'article') : (noun?.many ?? 'articles')} published across ${topics} ${topics === 1 ? 'topic' : 'topics'}`,
|
|
191
|
+
workHeading: 'Published Work',
|
|
192
|
+
workSubtitle: (total: number) =>
|
|
193
|
+
`${total} ${total === 1 ? 'piece' : 'pieces'} in total. The latest from each topic, newest first.`,
|
|
194
|
+
showMore: (n: number) => `Show ${n} more`,
|
|
195
|
+
topicsHeading: 'Explore by topic',
|
|
196
|
+
emptyHeading: 'Nothing published yet',
|
|
197
|
+
emptyBody: (name: string) => `${name}'s work will appear here as pieces go live across the site.`,
|
|
198
|
+
},
|
|
199
|
+
authorsIndexPage: {
|
|
200
|
+
eyebrow: 'Named Contributors',
|
|
201
|
+
heading: 'Editorial Team',
|
|
202
|
+
contributorsLabel: 'Named contributors',
|
|
203
|
+
entriesLabel: 'Signed articles',
|
|
204
|
+
aboutLabel: 'About the site',
|
|
205
|
+
standardsLabel: 'Editorial standards',
|
|
206
|
+
},
|
|
185
207
|
};
|
|
186
208
|
|
|
187
209
|
const eraLabelsIt = { indexLabel: 'Epoche', dossiersLabel: 'Approfondisci' };
|
|
@@ -365,6 +387,28 @@ export const LABELS_IT: typeof LABELS = {
|
|
|
365
387
|
pageLabel: (page: number) => `Pagina ${page}`,
|
|
366
388
|
timelineLink: (era: string) => `Vedi ${era} nella cronologia, con i suoi personaggi e monumenti`,
|
|
367
389
|
},
|
|
390
|
+
authorPage: {
|
|
391
|
+
roleEyebrow: 'Contributore editoriale',
|
|
392
|
+
portraitAlt: (name: string) => `Ritratto di ${name}`,
|
|
393
|
+
credentialsHeading: 'Credenziali',
|
|
394
|
+
statsLine: (items: number, topics: number, noun?: { one: string; many: string }) =>
|
|
395
|
+
`${items} ${items === 1 ? (noun?.one ?? 'articolo pubblicato') : (noun?.many ?? 'articoli pubblicati')} in ${topics} ${topics === 1 ? 'argomento' : 'argomenti'}`,
|
|
396
|
+
workHeading: 'Lavori pubblicati',
|
|
397
|
+
workSubtitle: (total: number) =>
|
|
398
|
+
`${total} ${total === 1 ? 'contenuto' : 'contenuti'} in totale. I più recenti per ogni argomento.`,
|
|
399
|
+
showMore: (n: number) => `Mostra altri ${n}`,
|
|
400
|
+
topicsHeading: 'Esplora per argomento',
|
|
401
|
+
emptyHeading: 'Nessun contenuto ancora pubblicato',
|
|
402
|
+
emptyBody: (name: string) => `I contenuti di ${name} appariranno qui non appena saranno pubblicati sul sito.`,
|
|
403
|
+
},
|
|
404
|
+
authorsIndexPage: {
|
|
405
|
+
eyebrow: 'Contributori nominali',
|
|
406
|
+
heading: 'Redazione',
|
|
407
|
+
contributorsLabel: 'Contributori nominali',
|
|
408
|
+
entriesLabel: 'Articoli firmati',
|
|
409
|
+
aboutLabel: 'Informazioni sul sito',
|
|
410
|
+
standardsLabel: 'Standard editoriali',
|
|
411
|
+
},
|
|
368
412
|
};
|
|
369
413
|
|
|
370
414
|
export const LABELS_BY_LOCALE = {
|