@sarimarcus/content-sites-ui 0.55.2 → 0.56.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.
@@ -81,6 +81,38 @@ export const LABELS = {
81
81
  alsoExplore: { eyebrow: 'Also explore' },
82
82
  articleCategoryNav: { ariaLabel: 'Browse articles by topic', allLabel: 'All' },
83
83
  articleFeatureCard: { readLabel: 'Read article', updatedLabel: 'Updated' },
84
+ articleCardGrid: { readLabel: 'Read', updatedLabel: 'Updated', minutesSuffix: 'min' },
85
+ articleHubSection: { moreLabel: 'See all' },
86
+ articleTagPage: {
87
+ homeLabel: 'Home',
88
+ articlesLabel: 'Articles',
89
+ eyebrow: 'Topic Tag',
90
+ countOne: 'article',
91
+ countMany: 'articles',
92
+ browseTopicsLabel: 'Browse categories',
93
+ },
94
+ shareButtons: {
95
+ ariaLabel: 'Share this article',
96
+ shareLabel: 'Share',
97
+ whatsappLabel: 'Share on WhatsApp',
98
+ flipboardLabel: 'Save to Flipboard',
99
+ xLabel: 'Share on X',
100
+ linkedinLabel: 'Share on LinkedIn',
101
+ nativeShareLabel: 'More sharing options',
102
+ copyLabel: 'Copy link',
103
+ copiedLabel: 'Copied',
104
+ },
105
+ editorialHomePage: {
106
+ featuredEyebrow: 'Featured Story',
107
+ latestHeading: 'Latest Articles',
108
+ latestViewAll: 'All articles',
109
+ trendingHeading: 'In Focus',
110
+ topicsMoreLabel: 'See all',
111
+ authorsHeading: 'Written by',
112
+ emptyEyebrow: 'Editorial Desk',
113
+ emptyHeading: 'New stories are in preparation',
114
+ emptyBody: 'Our editorial team is researching and fact-checking the first features for this publication.',
115
+ },
84
116
  eraChip: { ariaLabel: (label: string, range: string) => `${label}, ${range}: see this era on the chronology` },
85
117
  personChip: { ariaLabel: (name: string, dates?: string) => `${name}${dates ? `, ${dates}` : ''}: read their profile` },
86
118
  eraPeopleRow: { peopleLabel: 'People:', more: (n: number) => `+${n} more`, moreSr: ' people', fewer: 'Show fewer' },
@@ -121,13 +153,22 @@ export const LABELS = {
121
153
  visitTiming: { title: 'When to Visit', bestSeason: 'Best season', quietestHours: 'Quietest hours', visitDuration: 'Visit duration' },
122
154
  articlesNavMenu: { latestHeading: 'Latest' },
123
155
  siteFooter: { cookieLabel: 'Cookie preferences', rightsLabel: 'All rights reserved.', legalAriaLabel: 'Legal' },
124
- siteHeader: { label: 'Main navigation', openLabel: 'Open menu', closeLabel: 'Close menu' },
156
+ siteHeader: { label: 'Main navigation', openLabel: 'Open menu', closeLabel: 'Close menu', trendingLabel: 'Trending' },
125
157
  articleMetadata: {
126
158
  writtenByLabel: 'Written by',
127
159
  portraitLabel: 'Portrait of',
128
160
  updatedLabel: 'Updated',
129
161
  publishedLabel: 'Published',
130
162
  ariaLabel: 'Article information',
163
+ aboutAuthorLabel: 'About the author',
164
+ fullProfileLabel: 'Full author profile',
165
+ },
166
+ articlePage: {
167
+ homeLabel: 'Home',
168
+ articlesLabel: 'Articles',
169
+ tagsAriaLabel: 'Article tags',
170
+ allArticlesLabel: 'All articles',
171
+ relatedTitle: 'Related reading',
131
172
  },
132
173
  authoritativeSources: {
133
174
  title: 'Sources',
@@ -286,6 +327,38 @@ export const LABELS_IT: typeof LABELS = {
286
327
  alsoExplore: { eyebrow: 'Esplora anche' },
287
328
  articleCategoryNav: { ariaLabel: 'Sfoglia gli articoli per argomento', allLabel: 'Tutti' },
288
329
  articleFeatureCard: { readLabel: 'Leggi l’articolo', updatedLabel: 'Aggiornato' },
330
+ articleCardGrid: { readLabel: 'Leggi', updatedLabel: 'Aggiornato', minutesSuffix: 'min' },
331
+ articleHubSection: { moreLabel: 'Vedi tutti' },
332
+ articleTagPage: {
333
+ homeLabel: 'Home',
334
+ articlesLabel: 'Articoli',
335
+ eyebrow: 'Tag argomento',
336
+ countOne: 'articolo',
337
+ countMany: 'articoli',
338
+ browseTopicsLabel: 'Sfoglia le categorie',
339
+ },
340
+ shareButtons: {
341
+ ariaLabel: 'Condividi questo articolo',
342
+ shareLabel: 'Condividi',
343
+ whatsappLabel: 'Condividi su WhatsApp',
344
+ flipboardLabel: 'Salva su Flipboard',
345
+ xLabel: 'Condividi su X',
346
+ linkedinLabel: 'Condividi su LinkedIn',
347
+ nativeShareLabel: 'Altre opzioni di condivisione',
348
+ copyLabel: 'Copia link',
349
+ copiedLabel: 'Copiato',
350
+ },
351
+ editorialHomePage: {
352
+ featuredEyebrow: 'In evidenza',
353
+ latestHeading: 'Ultimi articoli',
354
+ latestViewAll: 'Tutti gli articoli',
355
+ trendingHeading: 'In primo piano',
356
+ topicsMoreLabel: 'Vedi tutti',
357
+ authorsHeading: 'Scritto da',
358
+ emptyEyebrow: 'Redazione',
359
+ emptyHeading: 'Nuovi articoli in preparazione',
360
+ emptyBody: 'La nostra redazione sta preparando i primi approfondimenti per questa pubblicazione.',
361
+ },
289
362
  eraChip: { ariaLabel: (label: string, range: string) => `${label}, ${range}: vedi quest’epoca nella cronologia` },
290
363
  personChip: { ariaLabel: (name: string, dates?: string) => `${name}${dates ? `, ${dates}` : ''}: leggi il profilo` },
291
364
  eraPeopleRow: { peopleLabel: 'Personaggi:', more: (n: number) => `+${n} altri`, moreSr: ' personaggi', fewer: 'Mostra meno' },
@@ -326,13 +399,22 @@ export const LABELS_IT: typeof LABELS = {
326
399
  visitTiming: { title: 'Quando visitare', bestSeason: 'Periodo migliore', quietestHours: 'Orari più tranquilli', visitDuration: 'Durata della visita' },
327
400
  articlesNavMenu: { latestHeading: 'Ultimi articoli' },
328
401
  siteFooter: { cookieLabel: 'Preferenze cookie', rightsLabel: 'Tutti i diritti riservati.', legalAriaLabel: 'Note legali' },
329
- siteHeader: { label: 'Navigazione principale', openLabel: 'Apri menu', closeLabel: 'Chiudi menu' },
402
+ siteHeader: { label: 'Navigazione principale', openLabel: 'Apri menu', closeLabel: 'Chiudi menu', trendingLabel: 'Di tendenza' },
330
403
  articleMetadata: {
331
404
  writtenByLabel: 'Scritto da',
332
405
  portraitLabel: 'Ritratto di',
333
406
  updatedLabel: 'Aggiornato il',
334
407
  publishedLabel: 'Pubblicato il',
335
408
  ariaLabel: 'Informazioni sull’articolo',
409
+ aboutAuthorLabel: 'Informazioni sull’autore',
410
+ fullProfileLabel: 'Profilo completo dell’autore',
411
+ },
412
+ articlePage: {
413
+ homeLabel: 'Home',
414
+ articlesLabel: 'Articoli',
415
+ tagsAriaLabel: 'Tag dell’articolo',
416
+ allArticlesLabel: 'Tutti gli articoli',
417
+ relatedTitle: 'Letture correlate',
336
418
  },
337
419
  authoritativeSources: {
338
420
  title: 'Fonti',
@@ -11,9 +11,15 @@
11
11
  * The ids default to the ones the sites reserve (`main-nav`, `mobile-menu`, `mobile-menu-btn`). The panel sits outside
12
12
  * `<nav>`, so it carries its own `data-pagefind-ignore`.
13
13
  */
14
+ import Container from '../layout/Container.astro';
14
15
  import { Icon } from '../primitives/index.ts';
15
16
  import { getLabels } from '../internal/labels';
16
17
 
18
+ export interface TrendingTopicLink {
19
+ label: string;
20
+ href: string;
21
+ }
22
+
17
23
  interface Props {
18
24
  label?: string;
19
25
  /** Background of the header bar and the mobile panel. */
@@ -24,6 +30,9 @@ interface Props {
24
30
  openLabel?: string;
25
31
  closeLabel?: string;
26
32
  searchPath?: string;
33
+ /** Optional Xataka-style secondary "Trending Topics" horizontal sub-bar rendered under the main nav row. */
34
+ trendingTags?: readonly TrendingTopicLink[];
35
+ trendingLabel?: string;
27
36
  locale?: string;
28
37
  id?: string;
29
38
  panelId?: string;
@@ -40,6 +49,8 @@ const {
40
49
  openLabel = defaultLabels.openLabel,
41
50
  closeLabel = defaultLabels.closeLabel,
42
51
  searchPath,
52
+ trendingTags = [],
53
+ trendingLabel = defaultLabels.trendingLabel,
43
54
  id = 'main-nav',
44
55
  panelId = 'mobile-menu',
45
56
  toggleId = 'mobile-menu-btn',
@@ -78,7 +89,23 @@ const {
78
89
  </button>
79
90
  </div>
80
91
  </div>
81
- </nav>
92
+ </nav>{trendingTags.length > 0 && (
93
+ <div class="hidden md:block border-t border-border/60 bg-muted/40">
94
+ <Container class="flex items-center gap-3 h-9 overflow-x-auto text-xs">
95
+ <span class="font-semibold uppercase tracking-widest text-primary shrink-0">{trendingLabel}</span>
96
+ <span class="text-border shrink-0" aria-hidden="true">|</span>
97
+ <ul class="flex items-center gap-4 shrink-0">
98
+ {trendingTags.map((tag) => (
99
+ <li>
100
+ <a href={tag.href} class="text-muted-foreground hover:text-foreground transition-colors font-medium whitespace-nowrap">
101
+ #{tag.label}
102
+ </a>
103
+ </li>
104
+ ))}
105
+ </ul>
106
+ </Container>
107
+ </div>
108
+ )}
82
109
  </header>
83
110
 
84
111
  <div id={panelId} class:list={['lg:hidden hidden fixed inset-x-0 top-16 bottom-0 z-50 overflow-y-auto overscroll-contain', surfaceClass]} data-pagefind-ignore>
@@ -1,6 +1,7 @@
1
1
  // Public surface of @sarimarcus/content-sites-ui/navigation: site chrome shells. Sites compose every link, panel and
2
2
  // logo; these own landmarks, ARIA state and the bundled controllers.
3
3
  export { default as SiteHeader } from './SiteHeader.astro';
4
+ export type { TrendingTopicLink } from './SiteHeader.astro';
4
5
  export { default as NavDropdown } from './NavDropdown.astro';
5
6
  export { default as MobileNavSection } from './MobileNavSection.astro';
6
7
  export { default as SiteFooter } from './SiteFooter.astro';
@@ -18,6 +18,7 @@ import { Image } from 'astro:assets';
18
18
  import { isUpdatedAfterPublication } from '@sarimarcus/content-sites-core/articles';
19
19
  import { formatDisplayDay } from '@sarimarcus/content-sites-core/dates';
20
20
  import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
21
+ import Badge from '../primitives/Badge.astro';
21
22
  import EraChip from '../editorial/EraChip.astro';
22
23
  import type { ArticleAuthor } from './types';
23
24
  import { getLabels } from '../internal/labels';
@@ -75,6 +76,11 @@ const showModified = isUpdatedAfterPublication({ datePublished, dateModified })
75
76
  const name = author?.name;
76
77
  const portraitAlt = `${portraitLabel} ${name}`;
77
78
  const credentials = author?.credentials ?? null;
79
+ const jobTitle = author?.jobTitle ?? null;
80
+ const bio = author?.bio ?? null;
81
+ const expertise = author?.expertise ?? null;
82
+ const aboutAuthorLabel = defaultLabels.articleMetadata.aboutAuthorLabel;
83
+ const fullProfileLabel = defaultLabels.articleMetadata.fullProfileLabel;
78
84
  const grouped = bylineWhitespace === 'grouped';
79
85
  const bylineLead = author ? (grouped ? ' ' : ' ') : (grouped ? '' : ' ');
80
86
  ---
@@ -119,9 +125,38 @@ const bylineLead = author ? (grouped ? ' ' : ' ') : (grouped ? '' : ' ');
119
125
  </a>
120
126
  ) : (
121
127
  <span class="font-semibold text-foreground">{name}</span>
122
- ))}
128
+ ))}{author && jobTitle && (
129
+ <Badge tone="primary" size="sm" lines={1} class="ml-2 align-middle">
130
+ {jobTitle}
131
+ </Badge>
132
+ )}
123
133
  {author && credentials && (
124
134
  <p class="mt-1 text-sm text-muted-foreground leading-snug line-clamp-2">{credentials}</p>
135
+ )}{author && bio && (
136
+ <details class="mt-2 rounded-lg border border-border/80 bg-card/70 px-3 py-2 text-xs text-muted-foreground">
137
+ <summary class="cursor-pointer font-medium text-foreground/90 hover:text-primary transition-colors select-none">
138
+ {aboutAuthorLabel}
139
+ </summary>
140
+ <div class="mt-2 space-y-2 leading-relaxed">
141
+ <p>{bio}</p>
142
+ {expertise && expertise.length > 0 && (
143
+ <div class="flex flex-wrap gap-1.5 pt-1">
144
+ {expertise.map((topic) => (
145
+ <Badge tone="neutral" size="sm" lines={1}>
146
+ {topic}
147
+ </Badge>
148
+ ))}
149
+ </div>
150
+ )}
151
+ {author.href && (
152
+ <p class="pt-1">
153
+ <a href={author.href} class="font-semibold text-primary hover:underline">
154
+ {fullProfileLabel} &rarr;
155
+ </a>
156
+ </p>
157
+ )}
158
+ </div>
159
+ </details>
125
160
  )}
126
161
  {/* freshness first */}
127
162
  <div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground">
package/src/seo/author.ts CHANGED
@@ -7,6 +7,16 @@ export interface ArticleAuthorProfile {
7
7
  slug: string;
8
8
  photo?: string;
9
9
  credentials?: string;
10
+ jobTitle?: string;
11
+ role?: string;
12
+ bio?: string;
13
+ expertise?: readonly string[];
14
+ }
15
+
16
+ export interface ToArticleAuthorOptions {
17
+ routes?: SiteRoutes;
18
+ /** Opt in to Xataka-style specialist role badge and expandable author credential mini-card in ArticleMetadata. */
19
+ includeExtendedBio?: boolean;
10
20
  }
11
21
 
12
22
  /**
@@ -18,15 +28,28 @@ export function toArticleAuthor(
18
28
  name: string | undefined,
19
29
  findProfile: (name: string) => ArticleAuthorProfile | undefined,
20
30
  portrait: (slug: string) => ImageMetadata | null,
21
- routes?: SiteRoutes,
31
+ routesOrOptions?: SiteRoutes | ToArticleAuthorOptions,
22
32
  ): ArticleAuthor | undefined {
23
33
  if (!name) return undefined;
24
34
  const profile = findProfile(name);
35
+ const isOptions =
36
+ routesOrOptions !== undefined &&
37
+ ('includeExtendedBio' in routesOrOptions || 'routes' in routesOrOptions);
38
+ const routes = isOptions ? (routesOrOptions as ToArticleAuthorOptions).routes : (routesOrOptions as SiteRoutes | undefined);
39
+ const includeExtendedBio = isOptions ? Boolean((routesOrOptions as ToArticleAuthorOptions).includeExtendedBio) : false;
40
+
25
41
  return {
26
42
  name,
27
43
  href: profile ? url(routePath('author', profile.slug, routes)) : null,
28
44
  image: profile?.slug ? portrait(profile.slug) : null,
29
45
  photoUrl: profile?.photo ? url(profile.photo) : null,
30
46
  credentials: profile?.credentials ?? null,
47
+ ...(includeExtendedBio && profile
48
+ ? {
49
+ jobTitle: profile.jobTitle ?? profile.role ?? null,
50
+ bio: profile.bio ?? null,
51
+ expertise: profile.expertise ?? null,
52
+ }
53
+ : {}),
31
54
  };
32
55
  }
package/src/seo/index.ts CHANGED
@@ -6,7 +6,7 @@ export { default as ArticleMetadata } from './ArticleMetadata.astro';
6
6
  export { default as AuthoritativeSources } from './AuthoritativeSources.astro';
7
7
  export { escapeJsonLd } from './jsonLd';
8
8
  export { toArticleAuthor } from './author';
9
- export type { ArticleAuthorProfile } from './author';
9
+ export type { ArticleAuthorProfile, ToArticleAuthorOptions } from './author';
10
10
  export { astroSchemaInput } from './schemaContext';
11
11
  export { COMMON_SOURCE_LABELS } from './sourceLabels';
12
12
  export type { BreadcrumbItem, ArticleAuthor, SourceInput, DomainClassifier } from './types';
package/src/seo/types.ts CHANGED
@@ -13,6 +13,9 @@ export interface ArticleAuthor {
13
13
  image?: ImageMetadata | null;
14
14
  photoUrl?: string | null;
15
15
  credentials?: string | null;
16
+ jobTitle?: string | null;
17
+ bio?: string | null;
18
+ expertise?: readonly string[] | null;
16
19
  }
17
20
 
18
21
  export type SourceInput = string | { name?: string; url: string; description?: string; quote?: string; lang?: string };