@sarimarcus/content-sites-ui 0.55.3 → 0.56.1

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 CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All packages in the platform release in lockstep; entries are per release version.
4
4
 
5
+ ## 0.56.1 (2026-11-05)
6
+
7
+ - `ArticlePage`: place `<main>` around the `size="measure"` body `<Container>` (after `ContentHero` and `BreadcrumbBand`) so the first non-shell band inside `<main>` is `max-w-measure`, emit `data-pagefind-meta="type:article"` and `data-pagefind-filter="audience:<slug>"`, and wrap prose paragraph blocks in `<div class="text-base text-muted-foreground leading-relaxed mb-4">` (SLA-3723).
8
+
9
+ ## 0.56.0 (2026-11-05)
10
+
11
+ - `editorial`: add `ArticlePage`, `DEFAULT_INTERLUDE_LABELS`, `EditorialHomePage`, `ArticleTagPage`, `ShareButtons`, `buildShareUrls`, `EDITORIAL_AUTHOR_WORK_CONFIG`, `authorPhotoDataUri`, and promoted `ArticleCardGrid` (with optional `categoryLabels`, `tagLabels`, `eagerFirst`, `columns`); add `compact` variant to `RelatedCard` and `subTags`/`moreHref` to `ArticleHubSection` (SLA-3716, SLA-3718, SLA-3720, SLA-3721, SLA-3722).
12
+ - `navigation`: add optional `trendingTags` horizontal sub-bar to `SiteHeader` (SLA-3719).
13
+ - `seo`: add optional `jobTitle`, `bio`, `expertise` (`includeExtendedBio: true` in `toArticleAuthor`) and expandable credential mini-card in `ArticleMetadata` (SLA-3720, SLA-3721).
14
+
5
15
  ## 0.55.3 (2026-11-04)
6
16
 
7
17
  - `editorial`: `EraListingPage` and `EraListingRoute` accept optional page-1 `places` and `faq` slots (with `faq` rendered inside a `size="measure"` `Container` only when non-empty, matching `ArticleTopicPage`) (SLA-3327).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sarimarcus/content-sites-ui",
3
- "version": "0.55.3",
3
+ "version": "0.56.1",
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.55.3"
53
+ "@sarimarcus/content-sites-core": "0.56.1"
54
54
  }
55
55
  }
@@ -4,6 +4,7 @@
4
4
  * a read link. Dates arrive formatted; the image is the route's import.
5
5
  */
6
6
  import ArticleByline from './ArticleByline.astro';
7
+ import Badge from '../primitives/Badge.astro';
7
8
  import Icon from '../primitives/Icon.astro';
8
9
  import type { ArticleSummary } from './types';
9
10
  import ResponsivePicture from '../primitives/ResponsivePicture.astro';
@@ -39,7 +40,16 @@ const { article: a, readLabel, updatedLabel, loading = 'lazy', pagefindIgnore =
39
40
  ) : (
40
41
  <div class="aspect-[4/3] bg-muted/40"></div>
41
42
  )}
42
- <div class="p-5 flex-1 flex flex-col">
43
+ <div class="p-5 flex-1 flex flex-col">{(a.categoryLabel || a.tagLabel) && (
44
+ <div class="mb-2 flex flex-wrap items-center gap-2 text-xs">
45
+ {a.categoryLabel && (
46
+ <span class="font-semibold uppercase tracking-wider text-primary">{a.categoryLabel}</span>
47
+ )}
48
+ {a.tagLabel && (
49
+ <Badge tone="neutral" size="sm" lines={1}>{a.tagLabel}</Badge>
50
+ )}
51
+ </div>
52
+ )}
43
53
  <h3 class="text-base sm:text-lg font-semibold font-display leading-snug group-hover:text-primary transition-colors text-balance">
44
54
  {a.title}
45
55
  </h3>
@@ -0,0 +1,99 @@
1
+ ---
2
+ /**
3
+ * ArticleCardGrid — the article listing grid (ui ArticleGrid) from article collection entries: the date label shows
4
+ * the last update when it falls on another calendar day than publication, formatted in `timeZone`.
5
+ * Supports optional category/tag badges and reading-time labels for editorial sites while remaining byte-identical
6
+ * for tourism callers.
7
+ */
8
+ import type { ImageMetadata } from 'astro';
9
+ import { isUpdatedAfterPublication } from '@sarimarcus/content-sites-core/articles';
10
+ import { formatDisplayDay } from '@sarimarcus/content-sites-core/dates';
11
+ import { readingTime } from '@sarimarcus/content-sites-core/text';
12
+ import { routePath, url as defaultUrl, type SiteRoutes } from '@sarimarcus/content-sites-core/url';
13
+ import { getLabels } from '../internal/labels';
14
+ import ArticleGrid from './ArticleGrid.astro';
15
+
16
+ export interface ArticleCardGridEntry {
17
+ data: {
18
+ slug: string;
19
+ title: string;
20
+ description: string;
21
+ author?: string;
22
+ imageAlt?: string;
23
+ datePublished?: string;
24
+ dateModified?: string;
25
+ category?: string;
26
+ tags?: readonly string[];
27
+ sections?: readonly { body: string; subsections?: readonly { body: string }[] }[];
28
+ };
29
+ }
30
+
31
+ interface Props {
32
+ articles: readonly ArticleCardGridEntry[];
33
+ articleImages: Readonly<Record<string, ImageMetadata>>;
34
+ /** Optional URL resolver; defaults to core `url`. */
35
+ url?: (path: string) => string;
36
+ /** Optional category slug -> display label map. */
37
+ categoryLabels?: Readonly<Record<string, string>>;
38
+ /** Optional tag slug -> display label map. */
39
+ tagLabels?: Readonly<Record<string, string>>;
40
+ eagerFirst?: boolean;
41
+ /** IANA zone the card dates are shown in. */
42
+ timeZone?: string;
43
+ /** BCP-47 locale for card dates and default labels (defaults to `en-GB`). */
44
+ locale?: string;
45
+ readLabel?: string;
46
+ updatedLabel?: string;
47
+ /** Overrides of the `articles` route. */
48
+ routes?: SiteRoutes;
49
+ /** Grid column count when `class` is not supplied (defaults to 3). */
50
+ columns?: 2 | 3;
51
+ /** Grid classes; defaults to 1/2/3 columns (or 1/2 when `columns={2}`). */
52
+ class?: string;
53
+ }
54
+
55
+ const {
56
+ articles,
57
+ articleImages,
58
+ url: resolveUrl = defaultUrl,
59
+ categoryLabels,
60
+ tagLabels,
61
+ eagerFirst = false,
62
+ timeZone = 'Europe/Madrid',
63
+ locale = Astro.currentLocale && Astro.currentLocale !== 'en' ? Astro.currentLocale : 'en-GB',
64
+ readLabel = getLabels(locale).articleCardGrid.readLabel,
65
+ updatedLabel = getLabels(locale).articleCardGrid.updatedLabel,
66
+ routes,
67
+ columns = 3,
68
+ class: className = columns === 2 ? 'grid gap-6 sm:grid-cols-2' : 'grid gap-6 sm:grid-cols-2 lg:grid-cols-3',
69
+ } = Astro.props;
70
+
71
+ const minutesSuffix = getLabels(locale).articleCardGrid.minutesSuffix;
72
+
73
+ const items = articles.map(({ data: a }) => {
74
+ const updated = isUpdatedAfterPublication(a);
75
+ const dateTime = (updated ? a.dateModified : a.datePublished) ?? '';
76
+ const categoryLabel = a.category && categoryLabels ? categoryLabels[a.category] : undefined;
77
+ const firstTag = a.tags?.[0];
78
+ const tagLabel = firstTag && tagLabels ? (tagLabels[firstTag] ?? firstTag) : undefined;
79
+ const readingLabel = a.sections && (categoryLabels || tagLabels)
80
+ ? `${readingTime(a)} ${minutesSuffix}`
81
+ : undefined;
82
+ return {
83
+ href: resolveUrl(routePath('articles', a.slug, routes)),
84
+ title: a.title,
85
+ description: a.description,
86
+ author: a.author,
87
+ image: articleImages[a.slug],
88
+ imageAlt: a.imageAlt,
89
+ dateTime,
90
+ dateLabel: formatDisplayDay(dateTime, locale, timeZone),
91
+ updated,
92
+ readingLabel,
93
+ categoryLabel,
94
+ tagLabel,
95
+ };
96
+ });
97
+ ---
98
+
99
+ <ArticleGrid articles={items} readLabel={readLabel} updatedLabel={updatedLabel} eagerFirst={eagerFirst} class={className} />
@@ -7,17 +7,18 @@ interface Props {
7
7
  articles: ArticleSummary[];
8
8
  readLabel: string;
9
9
  updatedLabel: string;
10
+ eagerFirst?: boolean;
10
11
  pagefindIgnore?: boolean;
11
12
  class?: string;
12
13
  }
13
14
 
14
- const { articles, readLabel, updatedLabel, pagefindIgnore = false, class: className = 'grid gap-6 sm:grid-cols-2' } = Astro.props;
15
+ const { articles, readLabel, updatedLabel, eagerFirst = false, pagefindIgnore = false, class: className = 'grid gap-6 sm:grid-cols-2' } = Astro.props;
15
16
  ---
16
17
 
17
18
  {articles.length > 0 && (
18
19
  <div class={className}>
19
- {articles.map((article) => (
20
- <ArticleCard article={article} readLabel={readLabel} updatedLabel={updatedLabel} pagefindIgnore={pagefindIgnore} />
20
+ {articles.map((article, idx) => (
21
+ <ArticleCard article={article} readLabel={readLabel} updatedLabel={updatedLabel} loading={eagerFirst && idx === 0 ? 'eager' : 'lazy'} pagefindIgnore={pagefindIgnore} />
21
22
  ))}
22
23
  </div>
23
24
  )}
@@ -1,21 +1,73 @@
1
1
  ---
2
2
  /**
3
- * ArticleHubSection — one titled section of the articles hub (trending, latest, recently updated): a heading over
4
- * the slotted card grid. `count` is an optional render guard: 0 renders nothing, so no empty heading is left behind.
3
+ * ArticleHubSection — one titled section of the articles hub or editorial homepage (trending, latest, recently updated,
4
+ * or category rail): a heading (plus optional Xataka-style sub-tag quick pills and "See all" link) over the slotted card grid.
5
+ * `count` is an optional render guard: 0 renders nothing, so no empty heading is left behind.
5
6
  */
7
+ import Chip from '../primitives/Chip.astro';
8
+ import LinkArrow from '../primitives/LinkArrow.astro';
9
+ import { getLabels } from '../internal/labels';
10
+
11
+ export interface ArticleHubSubTag {
12
+ label: string;
13
+ href: string;
14
+ }
15
+
6
16
  interface Props {
7
17
  heading: string;
8
18
  id: string;
9
19
  count?: number;
20
+ subTags?: readonly ArticleHubSubTag[];
21
+ moreHref?: string;
22
+ moreLabel?: string;
23
+ locale?: string;
10
24
  class?: string;
11
25
  }
12
26
 
13
- const { heading, id, count, class: className = 'mb-14' } = Astro.props;
27
+ const {
28
+ heading,
29
+ id,
30
+ count,
31
+ subTags = [],
32
+ moreHref,
33
+ moreLabel,
34
+ locale,
35
+ class: className = 'mb-14',
36
+ } = Astro.props;
37
+ const l = getLabels(locale).articleHubSection;
38
+ const resolvedMoreLabel = moreLabel ?? l.moreLabel;
39
+ const hasHeaderExtras = subTags.length > 0 || Boolean(moreHref);
14
40
  ---
15
41
 
16
42
  {(count === undefined || count > 0) && (
17
43
  <section class={className} aria-labelledby={id}>
18
- <h2 id={id} class="text-2xl sm:text-3xl font-normal font-display text-foreground mb-6">{heading}</h2>
44
+ {hasHeaderExtras ? (
45
+ <div class="mb-6 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
46
+ <h2 id={id} class="text-2xl sm:text-3xl font-normal font-display text-foreground">
47
+ {moreHref ? (
48
+ <a href={moreHref} class="hover:text-primary transition-colors">
49
+ {heading}
50
+ </a>
51
+ ) : (
52
+ heading
53
+ )}
54
+ </h2>
55
+ <div class="flex flex-wrap items-center gap-2">
56
+ {subTags.map((tag) => (
57
+ <Chip href={tag.href} size="sm" tone="outlineQuiet">
58
+ {tag.label}
59
+ </Chip>
60
+ ))}
61
+ {moreHref && (
62
+ <LinkArrow href={moreHref} size="sm" class="ml-1">
63
+ {resolvedMoreLabel}
64
+ </LinkArrow>
65
+ )}
66
+ </div>
67
+ </div>
68
+ ) : (
69
+ <h2 id={id} class="text-2xl sm:text-3xl font-normal font-display text-foreground mb-6">{heading}</h2>
70
+ )}
19
71
  <slot />
20
72
  </section>
21
73
  )}