@sarimarcus/content-sites-ui 0.54.1 → 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.
Files changed (61) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +5 -1
  3. package/package.json +2 -2
  4. package/src/affiliate/AffiliateCard.astro +10 -8
  5. package/src/affiliate/AffiliateCardSection.astro +5 -2
  6. package/src/affiliate/AffiliateCarousel.astro +6 -2
  7. package/src/affiliate/AffiliateComparisonTable.astro +14 -11
  8. package/src/affiliate/AmazonProductCard.astro +3 -2
  9. package/src/affiliate/AmazonProductSection.astro +5 -3
  10. package/src/affiliate/HotelAffiliateCTA.astro +15 -12
  11. package/src/affiliate/InlineAffiliateCTA.astro +3 -2
  12. package/src/affiliate/StickyCTA.astro +7 -4
  13. package/src/affiliate/TravelpayoutsWidget.astro +3 -2
  14. package/src/affiliate/cardItem.ts +1 -1
  15. package/src/composed/CardCarousel.astro +8 -5
  16. package/src/composed/FAQ.astro +3 -2
  17. package/src/composed/Pagination.astro +9 -6
  18. package/src/composed/TableOfContents.astro +7 -4
  19. package/src/editorial/AlsoExplore.astro +3 -2
  20. package/src/editorial/ArticleCategoryNav.astro +6 -3
  21. package/src/editorial/ArticleFeatureCard.astro +5 -2
  22. package/src/editorial/ArticleTopicPager.astro +9 -6
  23. package/src/editorial/AuthorPage.astro +292 -0
  24. package/src/editorial/AuthorsIndexPage.astro +127 -0
  25. package/src/editorial/ChronologyTimeline.astro +12 -7
  26. package/src/editorial/DossierSection.astro +7 -4
  27. package/src/editorial/EraChip.astro +5 -2
  28. package/src/editorial/EraDossiers.astro +3 -2
  29. package/src/editorial/EraPeopleRow.astro +10 -6
  30. package/src/editorial/EraScenes.astro +9 -6
  31. package/src/editorial/EraTimelineNav.astro +3 -2
  32. package/src/editorial/EventEditionBadge.astro +6 -4
  33. package/src/editorial/EventEditionBanner.astro +8 -5
  34. package/src/editorial/EventPage.astro +1 -1
  35. package/src/editorial/NotFoundPage.astro +5 -2
  36. package/src/editorial/PeopleBand.astro +5 -3
  37. package/src/editorial/PeopleChips.astro +4 -3
  38. package/src/editorial/PeopleHub.astro +11 -5
  39. package/src/editorial/PeopleTimeline.astro +7 -4
  40. package/src/editorial/PersonCard.astro +3 -2
  41. package/src/editorial/PersonChip.astro +3 -2
  42. package/src/editorial/PersonPage.astro +22 -17
  43. package/src/editorial/VisitTiming.astro +6 -3
  44. package/src/editorial/author-page.ts +113 -0
  45. package/src/editorial/chronology-page.ts +4 -2
  46. package/src/editorial/era-listing.ts +3 -2
  47. package/src/editorial/eventEdition.ts +3 -2
  48. package/src/editorial/index.ts +11 -0
  49. package/src/editorial/person-page.ts +5 -3
  50. package/src/internal/labels.ts +238 -0
  51. package/src/layout/DocumentShell.astro +7 -2
  52. package/src/navigation/ArticlesNavMenu.astro +4 -3
  53. package/src/navigation/SiteFooter.astro +7 -4
  54. package/src/navigation/SiteHeader.astro +7 -4
  55. package/src/navigation/types.ts +2 -0
  56. package/src/seo/ArticleMetadata.astro +9 -7
  57. package/src/seo/AuthoritativeSources.astro +20 -12
  58. package/src/seo/Breadcrumb.astro +6 -3
  59. package/src/seo/schemaContext.ts +2 -1
  60. package/src/seo/sourceLabels.ts +1 -0
  61. package/src/seo/types.ts +1 -1
@@ -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
+ }
@@ -1,7 +1,7 @@
1
1
  import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
2
2
  import { formatYearRange } from '@sarimarcus/content-sites-core/eras';
3
3
  import { formatLifeDates } from '@sarimarcus/content-sites-core/people';
4
- import { LABELS } from '../internal/labels';
4
+ import { getLabels } from '../internal/labels';
5
5
  import { groupByEra, type SceneItem } from './chronology';
6
6
 
7
7
  interface Dated {
@@ -36,6 +36,7 @@ export interface ChronologyInput {
36
36
  personPortrait: (slug: string) => SceneItem['image'] | undefined;
37
37
  roleLabel: (role: string) => string;
38
38
  personKind?: string;
39
+ locale?: string;
39
40
  /** Newest-first articles kept per era. */
40
41
  articlesPerEra?: number;
41
42
  }
@@ -64,7 +65,8 @@ export function buildChronology({
64
65
  personHref,
65
66
  personPortrait,
66
67
  roleLabel,
67
- personKind = LABELS.personRoute.personKind,
68
+ locale,
69
+ personKind = getLabels(locale).personRoute.personKind,
68
70
  articlesPerEra = 5,
69
71
  }: ChronologyInput): ChronologyModel {
70
72
  const rows: Row[] = sources.flatMap(([type, entries]) =>
@@ -1,7 +1,7 @@
1
1
  import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
2
2
  import { maxDate } from '@sarimarcus/content-sites-core/dates';
3
3
  import { toAbsoluteSiteUrl, url } from '@sarimarcus/content-sites-core/url';
4
- import { LABELS } from '../internal/labels';
4
+ import { getLabels, type LABELS } from '../internal/labels';
5
5
 
6
6
  interface ArticleLike {
7
7
  data: { slug: string; title: string; description?: string; dateModified?: string; datePublished?: string };
@@ -25,13 +25,14 @@ export interface EraListingInput {
25
25
  chronologyHref: string;
26
26
  /** Title and description of page 2+ (page 1 uses `copy`). */
27
27
  pagedMeta?: { title: string; description: string };
28
+ locale?: string;
28
29
  labels?: Partial<typeof LABELS.eraListing>;
29
30
  }
30
31
 
31
32
  /** The head data and strings of an era listing route; `EraListingRoute` renders the body from it. */
32
33
  export function buildEraListing(input: EraListingInput) {
33
34
  const { era, copy, eraArticles, pageArticles, page, totalPages, siteUrl: rawSiteUrl, basePath, hubPath, articlesHref, articleHref, chronologyHref, pagedMeta } = input;
34
- const L = { ...LABELS.eraListing, ...input.labels };
35
+ const L = { ...getLabels(input.locale).eraListing, ...input.labels };
35
36
  const first = page === 1;
36
37
  if (!first && !pagedMeta) throw new Error(`buildEraListing: page ${page} of ${hubPath} needs pagedMeta`);
37
38
  const siteUrl = rawSiteUrl.replace(/\/$/, '');
@@ -31,5 +31,6 @@ export function eventEdition(
31
31
  export const eventEditionState = (event: { startDate?: string; endDate?: string }, today?: string): EventEditionState | null =>
32
32
  eventEdition(event, today).state;
33
33
 
34
- /** `2026-05-10` as `10 May 2026`, in the sites' English; '' for a malformed day. */
35
- export const editionDateLabel = (day: string): string => formatUtcDate(day, { day: 'numeric', month: 'long', year: 'numeric' }, 'en-GB');
34
+ /** `2026-05-10` as `10 May 2026` (or in `locale`); '' for a malformed day. */
35
+ export const editionDateLabel = (day: string, locale: string = 'en-GB'): string =>
36
+ formatUtcDate(day, { day: 'numeric', month: 'long', year: 'numeric' }, locale);
@@ -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';
@@ -2,7 +2,7 @@ import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
2
2
  import { formatYearRange } from '@sarimarcus/content-sites-core/eras';
3
3
  import { buildPersonBacklinks, formatLifeDates, type PersonBacklink } from '@sarimarcus/content-sites-core/people';
4
4
  import type { RelatedItem } from '../composed/related';
5
- import { LABELS } from '../internal/labels';
5
+ import { getLabels } from '../internal/labels';
6
6
  import { groupByEra, type TimelineItem } from './chronology';
7
7
 
8
8
  type PersonType = string;
@@ -78,6 +78,7 @@ export interface PersonModelInput<A extends { data: { slug: string; dateModified
78
78
  /** The era timeline's section kinds. */
79
79
  monumentKind?: string;
80
80
  personKind?: string;
81
+ locale?: string;
81
82
  timelineLimit?: number;
82
83
  }
83
84
 
@@ -85,11 +86,12 @@ export interface PersonModelInput<A extends { data: { slug: string; dateModified
85
86
  export function buildPersonModel<A extends { data: { slug: string; dateModified?: unknown } }, M extends { data: { era?: string; yearStart?: number; yearEnd?: number } }, Pe extends PersonEntry>(
86
87
  input: PersonModelInput<A, M, Pe>,
87
88
  ) {
89
+ const defaultLabels = getLabels(input.locale).personRoute;
88
90
  const {
89
91
  person, links, entries, articles, monuments, people, era, toRelatedItem, toCardItem, personPortrait, personHref,
90
92
  placeTypes = ['monument', 'museum', 'neighborhood', 'walk'],
91
- monumentKind = LABELS.personRoute.monumentKind,
92
- personKind = LABELS.personRoute.personKind,
93
+ monumentKind = defaultLabels.monumentKind,
94
+ personKind = defaultLabels.personKind,
93
95
  timelineLimit = 5,
94
96
  } = input;
95
97
  const related = (link: PersonBacklink) => toRelatedItem(entries[`${link.type}:${link.slug}`] as never);
@@ -182,4 +182,242 @@ 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
  };
208
+
209
+ const eraLabelsIt = { indexLabel: 'Epoche', dossiersLabel: 'Approfondisci' };
210
+
211
+ export const LABELS_IT: typeof LABELS = {
212
+ affiliateCard: {
213
+ pricePrefix: 'Da ',
214
+ bestSeller: 'Più venduto',
215
+ topRated: 'Più apprezzato',
216
+ skipTheLine: 'Salta la fila',
217
+ cta: 'Prenota il tuo posto',
218
+ reviewCount: (n: string) => `(${n} recensioni)`,
219
+ },
220
+ affiliateCardSection: { title: 'Tour e attività consigliati' },
221
+ affiliateCarousel: { heading: 'Tour consigliati' },
222
+ affiliateComparisonTable: {
223
+ nameLabel: 'Opzione',
224
+ priceLabel: 'Prezzo',
225
+ featureLabel: 'Punto forte',
226
+ caption: 'Confronto delle opzioni',
227
+ ctaColumn: 'Prenota o vedi',
228
+ externalCta: 'Verifica disponibilità',
229
+ internalCta: 'Vedi dettagli',
230
+ externalAria: (cta: string, name: string) => `${cta}: ${name} (si apre in una nuova scheda)`,
231
+ internalAria: (cta: string, name: string) => `${cta}: ${name}`,
232
+ rated: (rating: number, count?: number) => `Valutato ${rating} su 5${count ? ` su ${count} recensioni` : ''}`,
233
+ },
234
+ amazonProductCard: { ctaLabel: 'Vedi su Amazon' },
235
+ amazonProductSection: { title: 'Letture consigliate' },
236
+ eventEdition: {
237
+ pastBadge: (date: string) => `Edizione passata · conclusa il ${date}`,
238
+ bannerLead: (date: string) => `Questa pagina descrive l’edizione conclusa il ${date}.`,
239
+ bannerTail: 'per i prossimi appuntamenti.',
240
+ eventsLink: 'Vedi i prossimi eventi',
241
+ },
242
+ hotelAffiliateCTA: {
243
+ headline: (name: string) => `Trova la tariffa migliore per ${name}`,
244
+ bookCta: (noun: string) => `Prenota questo ${noun}`,
245
+ searchCta: 'Verifica prezzi e disponibilità',
246
+ bookSubhead: 'Controlla disponibilità e tariffe attuali.',
247
+ searchSubhead: (noun: string) => `Cerca prezzi e disponibilità attuali per questo ${noun}.`,
248
+ from: 'da ',
249
+ perNight: ' / notte',
250
+ reviews: (n: string) => `(${n} recensioni)`,
251
+ ratingOn: (source: string) => `su ${source}`,
252
+ freeToSearch: 'Ricerca gratuita · Nessuna registrazione richiesta',
253
+ officialSite: (noun: string) => `Visita il sito ufficiale di questo ${noun}`,
254
+ },
255
+ inlineAffiliateCTA: { cta: 'Vedi i tour' },
256
+ stickyCTA: {
257
+ label: 'Prenota il tuo posto',
258
+ note: 'Hai trovato il tour giusto? Prenota il tuo posto prima che si esaurisca.',
259
+ dismissLabel: 'Chiudi',
260
+ },
261
+ travelpayoutsWidget: {
262
+ hotel: 'Ricerca hotel',
263
+ activity: 'Ricerca attività',
264
+ train: 'Ricerca treni e autobus',
265
+ car: 'Ricerca noleggio auto',
266
+ },
267
+ cardCarousel: {
268
+ viewAllLabel: 'Vedi tutto',
269
+ regionLabel: 'Carosello',
270
+ previousLabel: (name: string | undefined) => `Precedente, ${name ?? 'carosello'}`,
271
+ nextLabel: (name: string | undefined) => `Successivo, ${name ?? 'carosello'}`,
272
+ },
273
+ faq: { title: 'Domande frequenti' },
274
+ pagination: {
275
+ ariaLabel: 'Paginazione',
276
+ previousLabel: 'Precedente',
277
+ nextLabel: 'Successiva',
278
+ pageLabel: (page: number) => `Vai alla pagina ${page}`,
279
+ currentPageLabel: (page: number) => `Pagina ${page}, pagina corrente`,
280
+ },
281
+ tableOfContents: {
282
+ ariaLabel: 'Indice dei contenuti',
283
+ jumpLabel: 'Salta a una sezione',
284
+ stickyLabel: (name: string) => `${name} (fisso)`,
285
+ },
286
+ alsoExplore: { eyebrow: 'Esplora anche' },
287
+ articleCategoryNav: { ariaLabel: 'Sfoglia gli articoli per argomento', allLabel: 'Tutti' },
288
+ articleFeatureCard: { readLabel: 'Leggi l’articolo', updatedLabel: 'Aggiornato' },
289
+ eraChip: { ariaLabel: (label: string, range: string) => `${label}, ${range}: vedi quest’epoca nella cronologia` },
290
+ personChip: { ariaLabel: (name: string, dates?: string) => `${name}${dates ? `, ${dates}` : ''}: leggi il profilo` },
291
+ eraPeopleRow: { peopleLabel: 'Personaggi:', more: (n: number) => `+${n} altri`, moreSr: ' personaggi', fewer: 'Mostra meno' },
292
+ personCard: { cta: 'Leggi il profilo' },
293
+ peopleChips: { heading: 'Personaggi in questa storia' },
294
+ peopleBand: { allLabel: 'Tutti i personaggi storici' },
295
+ peopleTimeline: {
296
+ ariaLabel: 'Personaggi per epoca',
297
+ approximate: 'data sconosciuta, collocata a metà epoca',
298
+ dotLabel: (name: string, dates?: string) => (dates ? `${name}, ${dates}` : name),
299
+ },
300
+ peopleHub: {
301
+ indexLabel: 'Salta a un’epoca',
302
+ footstepsHeading: 'Sulle loro tracce',
303
+ placesHeading: 'Dove trovarli',
304
+ },
305
+ personRoute: { monumentKind: 'Monumento', personKind: 'Personaggio storico' },
306
+ personPage: {
307
+ readFullStory: 'Leggi la storia completa',
308
+ fullStoryHeading: 'La storia completa',
309
+ placesHeading: 'Luoghi da vedere',
310
+ readMoreHeading: 'Per approfondire',
311
+ timelineHeading: 'Nel suo tempo',
312
+ alsoKnownAs: 'Conosciuto anche come',
313
+ lifespan: (years: string, circa?: boolean, age?: number) =>
314
+ `Visse ${circa ? 'ca. ' : ''}${years}${age ? ` (circa ${age} anni)` : ''}`,
315
+ born: (year: string, circa?: boolean) => `Nascita ${circa ? 'ca. ' : ''}${year}`,
316
+ died: (year: string, circa?: boolean) => `Morte ${circa ? 'ca. ' : ''}${year}`,
317
+ tocLabels: { biography: 'Biografia', places: 'Luoghi', timeline: 'Cronologia', readMore: 'Per approfondire' },
318
+ },
319
+ articleTopicPager: {
320
+ heading: (topic: string) => `Continua in ${topic}`,
321
+ newerLabel: 'Più recente',
322
+ olderLabel: 'Precedente',
323
+ allLabel: (topic: string, count?: number) => (count ? `Tutti i ${count} articoli su ${topic}` : `Tutti gli articoli su ${topic}`),
324
+ },
325
+ notFoundPage: { exploreAriaLabel: 'Esplora le sezioni', searchShortcut: '⌘K' },
326
+ visitTiming: { title: 'Quando visitare', bestSeason: 'Periodo migliore', quietestHours: 'Orari più tranquilli', visitDuration: 'Durata della visita' },
327
+ articlesNavMenu: { latestHeading: 'Ultimi articoli' },
328
+ siteFooter: { cookieLabel: 'Preferenze cookie', rightsLabel: 'Tutti i diritti riservati.', legalAriaLabel: 'Note legali' },
329
+ siteHeader: { label: 'Navigazione principale', openLabel: 'Apri menu', closeLabel: 'Chiudi menu' },
330
+ articleMetadata: {
331
+ writtenByLabel: 'Scritto da',
332
+ portraitLabel: 'Ritratto di',
333
+ updatedLabel: 'Aggiornato il',
334
+ publishedLabel: 'Pubblicato il',
335
+ ariaLabel: 'Informazioni sull’articolo',
336
+ },
337
+ authoritativeSources: {
338
+ title: 'Fonti',
339
+ eyebrow: 'Per approfondire',
340
+ countLabel: 'riferimenti',
341
+ showLabel: 'Mostra',
342
+ hideLabel: 'Nascondi',
343
+ newTabLabel: '(si apre in una nuova scheda)',
344
+ },
345
+ breadcrumb: { homeLabel: 'Home', ariaLabel: 'Percorso di navigazione' },
346
+ chronologyTimeline: {
347
+ ...eraLabelsIt,
348
+ emptyLabel: '',
349
+ undatedLabel: 'Senza data',
350
+ },
351
+ eraTimelineNav: { ariaLabel: 'Epoche' },
352
+ eraScenes: {
353
+ ...eraLabelsIt,
354
+ castLabel: 'In quest’epoca',
355
+ peopleHeading: 'Personaggi',
356
+ monumentsHeading: 'Monumenti',
357
+ articlesHeading: 'Articoli',
358
+ allArticlesLabel: (count: number) => `Tutti i ${count} articoli`,
359
+ portraitAlt: (name: string) => `Ritratto di ${name}`,
360
+ },
361
+ dossierSection: {
362
+ viewAllLabel: 'Vedi tutto',
363
+ fallbackTitle: 'Altro da questo dossier',
364
+ themeLabels: {
365
+ gastronomy: 'Gastronomia',
366
+ nightlife: 'Vita notturna',
367
+ history: 'Storia',
368
+ religious: 'Patrimonio religioso',
369
+ architecture: 'Architettura',
370
+ art: 'Arte',
371
+ nature: 'Natura',
372
+ entertainment: 'Intrattenimento',
373
+ shopping: 'Shopping',
374
+ wellness: 'Benessere',
375
+ cultural: 'Cultura',
376
+ } as Record<string, string>,
377
+ },
378
+ eraListing: {
379
+ homeLabel: 'Home',
380
+ articlesLabel: 'Articoli',
381
+ articleSchemaType: 'Article',
382
+ eyebrow: (era: string) => `Articoli · ${era}`,
383
+ listHeading: (era: string) => `Articoli su ${era}`,
384
+ heroAlt: (era: string, place: string, range: string) => `${era} a ${place}, ${range}`,
385
+ articleOne: 'articolo',
386
+ articleMany: 'articoli',
387
+ pageLabel: (page: number) => `Pagina ${page}`,
388
+ timelineLink: (era: string) => `Vedi ${era} nella cronologia, con i suoi personaggi e monumenti`,
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
+ },
412
+ };
413
+
414
+ export const LABELS_BY_LOCALE = {
415
+ en: LABELS,
416
+ it: LABELS_IT,
417
+ } as const;
418
+
419
+ export function getLabels(locale?: string): typeof LABELS {
420
+ if (!locale) return LABELS;
421
+ const lang = locale.split(/[-_]/)[0]?.toLowerCase() ?? 'en';
422
+ return (LABELS_BY_LOCALE as Record<string, typeof LABELS>)[lang] ?? LABELS;
423
+ }
@@ -29,6 +29,8 @@ interface Props {
29
29
  ogImageAlt?: string;
30
30
  ogType?: string;
31
31
  ogLocale?: string;
32
+ /** BCP-47 locale (e.g. `it-IT`); derives `og:locale` (`it_IT`) when `ogLocale` is not given. */
33
+ locale?: string;
32
34
  articleAuthor?: string;
33
35
  /** Absolute URL of the author's profile page, resolved by the site. */
34
36
  articleAuthorUrl?: string;
@@ -63,7 +65,8 @@ const {
63
65
  ogImage = '/og-default.jpg',
64
66
  ogImageAlt,
65
67
  ogType,
66
- ogLocale = 'en',
68
+ ogLocale: providedOgLocale,
69
+ locale,
67
70
  articleAuthor,
68
71
  articleAuthorUrl,
69
72
  articlePublishedTime,
@@ -73,7 +76,7 @@ const {
73
76
  preloadImage,
74
77
  twitterHandle,
75
78
  themeColor,
76
- lang = 'en',
79
+ lang = Astro.currentLocale ?? 'en',
77
80
  rssTitle = siteName,
78
81
  stylesheets = [],
79
82
  gtmId,
@@ -85,6 +88,8 @@ const {
85
88
  footerClass,
86
89
  } = Astro.props;
87
90
 
91
+ const ogLocale = providedOgLocale ?? (locale ? locale.replace('-', '_') : (lang === 'en' ? 'en' : lang));
92
+
88
93
  const socialTitle = ogTitle ?? title;
89
94
  const baseUrl = import.meta.env.BASE_URL.replace(/\/$/, '');
90
95
  const canonicalUrl = providedCanonicalUrl
@@ -15,7 +15,7 @@ import MobileNavLink from './MobileNavLink.astro';
15
15
  import { isActivePath } from './activePath.ts';
16
16
  import { TONES } from './tones.ts';
17
17
  import type { ArticlesNavProps } from './types.ts';
18
- import { LABELS } from '../internal/labels';
18
+ import { getLabels } from '../internal/labels';
19
19
 
20
20
  type Props = ArticlesNavProps;
21
21
 
@@ -27,7 +27,8 @@ const {
27
27
  tone = 'primary',
28
28
  topicsHeading,
29
29
  topics,
30
- latestHeading = LABELS.articlesNavMenu.latestHeading,
30
+ locale = Astro.currentLocale && Astro.currentLocale !== 'en' ? Astro.currentLocale : 'en-GB',
31
+ latestHeading = getLabels(locale).articlesNavMenu.latestHeading,
31
32
  latest = [],
32
33
  all,
33
34
  iconStyle = 'plain',
@@ -47,7 +48,7 @@ const sectionActive = on(all.href);
47
48
 
48
49
  const heading = 'text-xs font-semibold text-muted-foreground uppercase tracking-wide';
49
50
  const ring = `focus-visible:ring-2 ${t.ring} focus-visible:ring-offset-2`;
50
- const day = (iso?: string) => formatUtcDate(iso, { day: 'numeric', month: 'short' }, 'en-GB');
51
+ const day = (iso?: string) => formatUtcDate(iso, { day: 'numeric', month: 'short' }, locale);
51
52
 
52
53
  const [first, ...rest] = latest;
53
54
  const feature = first?.image ? first : undefined;
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Icon } from '../primitives/index.ts';
9
9
  import type { FooterSection, NavLink, SiteIdentity } from './types.ts';
10
- import { LABELS } from '../internal/labels';
10
+ import { getLabels } from '../internal/labels';
11
11
 
12
12
  interface Props {
13
13
  identity: SiteIdentity;
@@ -21,6 +21,7 @@ interface Props {
21
21
  /** Shown between legal items (aria-hidden), e.g. `|`. */
22
22
  separator?: string;
23
23
  year?: number;
24
+ locale?: string;
24
25
  class?: string;
25
26
  gridClass?: string;
26
27
  brandClass?: string;
@@ -35,13 +36,15 @@ interface Props {
35
36
  ringClass?: string;
36
37
  }
37
38
 
39
+ const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).siteFooter;
40
+
38
41
  const {
39
42
  identity,
40
43
  sections = [],
41
44
  legal = [],
42
- cookieLabel = LABELS.siteFooter.cookieLabel,
43
- rightsLabel = LABELS.siteFooter.rightsLabel,
44
- legalAriaLabel = LABELS.siteFooter.legalAriaLabel,
45
+ cookieLabel = defaultLabels.cookieLabel,
46
+ rightsLabel = defaultLabels.rightsLabel,
47
+ legalAriaLabel = defaultLabels.legalAriaLabel,
45
48
  separator,
46
49
  year = new Date().getFullYear(),
47
50
  class: className = 'bg-inverse text-inverse-muted',
@@ -12,7 +12,7 @@
12
12
  * `<nav>`, so it carries its own `data-pagefind-ignore`.
13
13
  */
14
14
  import { Icon } from '../primitives/index.ts';
15
- import { LABELS } from '../internal/labels';
15
+ import { getLabels } from '../internal/labels';
16
16
 
17
17
  interface Props {
18
18
  label?: string;
@@ -24,18 +24,21 @@ interface Props {
24
24
  openLabel?: string;
25
25
  closeLabel?: string;
26
26
  searchPath?: string;
27
+ locale?: string;
27
28
  id?: string;
28
29
  panelId?: string;
29
30
  toggleId?: string;
30
31
  }
31
32
 
33
+ const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).siteHeader;
34
+
32
35
  const {
33
- label = LABELS.siteHeader.label,
36
+ label = defaultLabels.label,
34
37
  surfaceClass = 'bg-background/95 backdrop-blur-md',
35
38
  class: className = `fixed top-0 left-0 right-0 z-50 transition-[background-color,backdrop-filter,border-color,box-shadow] duration-300 border-b border-border ${surfaceClass}`,
36
39
  toggleClass = 'p-2 min-h-[44px] min-w-[44px] flex items-center justify-center rounded-lg transition-colors text-foreground hover:bg-muted cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2',
37
- openLabel = LABELS.siteHeader.openLabel,
38
- closeLabel = LABELS.siteHeader.closeLabel,
40
+ openLabel = defaultLabels.openLabel,
41
+ closeLabel = defaultLabels.closeLabel,
39
42
  searchPath,
40
43
  id = 'main-nav',
41
44
  panelId = 'mobile-menu',
@@ -72,4 +72,6 @@ export interface ArticlesNavProps {
72
72
  iconClass?: string;
73
73
  /** Mobile section wrapper classes. */
74
74
  class?: string;
75
+ /** BCP-47 locale for date formatting and default labels (defaults to `en-GB`). */
76
+ locale?: string;
75
77
  }
@@ -20,7 +20,7 @@ import { formatDisplayDay } from '@sarimarcus/content-sites-core/dates';
20
20
  import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
21
21
  import EraChip from '../editorial/EraChip.astro';
22
22
  import type { ArticleAuthor } from './types';
23
- import { LABELS } from '../internal/labels';
23
+ import { getLabels } from '../internal/labels';
24
24
 
25
25
  interface Props {
26
26
  author?: ArticleAuthor | null;
@@ -46,17 +46,19 @@ interface Props {
46
46
  eraBasePath?: string;
47
47
  }
48
48
 
49
+ const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale);
50
+
49
51
  const {
50
52
  author,
51
53
  datePublished,
52
54
  dateModified,
53
55
  timeZone = 'UTC',
54
- locale = 'en-GB',
55
- writtenByLabel = LABELS.articleMetadata.writtenByLabel,
56
- portraitLabel = LABELS.articleMetadata.portraitLabel,
57
- updatedLabel = LABELS.articleMetadata.updatedLabel,
58
- publishedLabel = LABELS.articleMetadata.publishedLabel,
59
- ariaLabel = LABELS.articleMetadata.ariaLabel,
56
+ locale = Astro.currentLocale && Astro.currentLocale !== 'en' ? Astro.currentLocale : 'en-GB',
57
+ writtenByLabel = defaultLabels.articleMetadata.writtenByLabel,
58
+ portraitLabel = defaultLabels.articleMetadata.portraitLabel,
59
+ updatedLabel = defaultLabels.articleMetadata.updatedLabel,
60
+ publishedLabel = defaultLabels.articleMetadata.publishedLabel,
61
+ ariaLabel = defaultLabels.articleMetadata.ariaLabel,
60
62
  placeholderClass = 'bg-gradient-to-br from-primary/20 to-accent/20',
61
63
  updatedIconClass = 'text-primary',
62
64
  bylineWhitespace = 'flat',