@sarimarcus/content-sites-ui 0.54.1 → 0.54.2
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/package.json +2 -2
- package/src/affiliate/AffiliateCard.astro +10 -8
- package/src/affiliate/AffiliateCardSection.astro +5 -2
- package/src/affiliate/AffiliateCarousel.astro +6 -2
- package/src/affiliate/AffiliateComparisonTable.astro +14 -11
- package/src/affiliate/AmazonProductCard.astro +3 -2
- package/src/affiliate/AmazonProductSection.astro +5 -3
- package/src/affiliate/HotelAffiliateCTA.astro +15 -12
- package/src/affiliate/InlineAffiliateCTA.astro +3 -2
- package/src/affiliate/StickyCTA.astro +7 -4
- package/src/affiliate/TravelpayoutsWidget.astro +3 -2
- package/src/affiliate/cardItem.ts +1 -1
- package/src/composed/CardCarousel.astro +8 -5
- package/src/composed/FAQ.astro +3 -2
- package/src/composed/Pagination.astro +9 -6
- package/src/composed/TableOfContents.astro +7 -4
- package/src/editorial/AlsoExplore.astro +3 -2
- package/src/editorial/ArticleCategoryNav.astro +6 -3
- package/src/editorial/ArticleFeatureCard.astro +5 -2
- package/src/editorial/ArticleTopicPager.astro +9 -6
- package/src/editorial/ChronologyTimeline.astro +12 -7
- package/src/editorial/DossierSection.astro +7 -4
- package/src/editorial/EraChip.astro +5 -2
- package/src/editorial/EraDossiers.astro +3 -2
- package/src/editorial/EraPeopleRow.astro +10 -6
- package/src/editorial/EraScenes.astro +9 -6
- package/src/editorial/EraTimelineNav.astro +3 -2
- package/src/editorial/EventEditionBadge.astro +6 -4
- package/src/editorial/EventEditionBanner.astro +8 -5
- package/src/editorial/EventPage.astro +1 -1
- package/src/editorial/NotFoundPage.astro +5 -2
- package/src/editorial/PeopleBand.astro +5 -3
- package/src/editorial/PeopleChips.astro +4 -3
- package/src/editorial/PeopleHub.astro +11 -5
- package/src/editorial/PeopleTimeline.astro +7 -4
- package/src/editorial/PersonCard.astro +3 -2
- package/src/editorial/PersonChip.astro +3 -2
- package/src/editorial/PersonPage.astro +22 -17
- package/src/editorial/VisitTiming.astro +6 -3
- package/src/editorial/chronology-page.ts +4 -2
- package/src/editorial/era-listing.ts +3 -2
- package/src/editorial/eventEdition.ts +3 -2
- package/src/editorial/person-page.ts +5 -3
- package/src/internal/labels.ts +194 -0
- package/src/layout/DocumentShell.astro +7 -2
- package/src/navigation/ArticlesNavMenu.astro +4 -3
- package/src/navigation/SiteFooter.astro +7 -4
- package/src/navigation/SiteHeader.astro +7 -4
- package/src/navigation/types.ts +2 -0
- package/src/seo/ArticleMetadata.astro +9 -7
- package/src/seo/AuthoritativeSources.astro +20 -12
- package/src/seo/Breadcrumb.astro +6 -3
- package/src/seo/schemaContext.ts +2 -1
- package/src/seo/sourceLabels.ts +1 -0
- package/src/seo/types.ts +1 -1
|
@@ -17,10 +17,12 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { outboundClassifier } from '@sarimarcus/content-sites-core/url';
|
|
19
19
|
import type { SourceInput, DomainClassifier } from './types';
|
|
20
|
-
import {
|
|
20
|
+
import { getLabels } from '../internal/labels';
|
|
21
21
|
|
|
22
22
|
interface Props {
|
|
23
23
|
sources: SourceInput[];
|
|
24
|
+
/** BCP-47 language/locale tag for default labels and quotation marks (defaults to `en`). */
|
|
25
|
+
lang?: string;
|
|
24
26
|
title?: string;
|
|
25
27
|
class?: string;
|
|
26
28
|
eyebrow?: string;
|
|
@@ -40,23 +42,25 @@ interface Props {
|
|
|
40
42
|
|
|
41
43
|
const {
|
|
42
44
|
sources,
|
|
43
|
-
|
|
45
|
+
lang = Astro.currentLocale ?? 'en',
|
|
46
|
+
title = getLabels(lang).authoritativeSources.title,
|
|
44
47
|
class: className = '',
|
|
45
|
-
eyebrow =
|
|
48
|
+
eyebrow = getLabels(lang).authoritativeSources.eyebrow,
|
|
46
49
|
eyebrowClass = 'text-xs font-semibold uppercase tracking-[0.18em] text-primary',
|
|
47
50
|
domainLabels = {},
|
|
48
51
|
domainClass = {},
|
|
49
52
|
disambiguate = false,
|
|
50
53
|
disambiguationSeparator = ' — ',
|
|
51
|
-
countLabel =
|
|
52
|
-
showLabel =
|
|
53
|
-
hideLabel =
|
|
54
|
-
newTabLabel =
|
|
54
|
+
countLabel = getLabels(lang).authoritativeSources.countLabel,
|
|
55
|
+
showLabel = getLabels(lang).authoritativeSources.showLabel,
|
|
56
|
+
hideLabel = getLabels(lang).authoritativeSources.hideLabel,
|
|
57
|
+
newTabLabel = getLabels(lang).authoritativeSources.newTabLabel,
|
|
55
58
|
toggleSizeClass = 'text-sm',
|
|
56
59
|
} = Astro.props;
|
|
57
60
|
|
|
58
61
|
if (!sources || sources.length === 0) return null;
|
|
59
62
|
|
|
63
|
+
const isItalian = lang === 'it' || lang.startsWith('it-') || lang.startsWith('it_');
|
|
60
64
|
const classify = typeof domainClass === 'function' ? domainClass : outboundClassifier(domainClass);
|
|
61
65
|
|
|
62
66
|
function domainLabel(url: string): string {
|
|
@@ -88,11 +92,11 @@ function pathFragment(url: string): string | null {
|
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
const normalized: { name: string; url: string; description?: string; quote?: string; linkRel: string | null; fromDomain: boolean }[] = sources.map((s) => {
|
|
95
|
+
const normalized: { name: string; url: string; description?: string; quote?: string; lang?: string; linkRel: string | null; fromDomain: boolean }[] = sources.map((s) => {
|
|
92
96
|
const entry =
|
|
93
97
|
typeof s === 'string'
|
|
94
98
|
? { name: domainLabel(s), url: s, fromDomain: true }
|
|
95
|
-
: { url: s.url, name: s.name ?? domainLabel(s.url), description: s.description, quote: s.quote, fromDomain: !s.name };
|
|
99
|
+
: { url: s.url, name: s.name ?? domainLabel(s.url), description: s.description, quote: s.quote, lang: s.lang, fromDomain: !s.name };
|
|
96
100
|
const cls = classify(entry.url);
|
|
97
101
|
return {
|
|
98
102
|
...entry,
|
|
@@ -154,11 +158,15 @@ if (disambiguate) {
|
|
|
154
158
|
{source.description && (
|
|
155
159
|
<p class="text-sm text-muted-foreground mt-1 leading-relaxed">{source.description}</p>
|
|
156
160
|
)}
|
|
157
|
-
{source.quote && (
|
|
158
|
-
<p class="text-sm text-muted-foreground mt-1.5 leading-relaxed italic border-l-2 border-primary/30 pl-3">
|
|
161
|
+
{source.quote && (isItalian ? (
|
|
162
|
+
<p lang={source.lang && source.lang !== lang ? source.lang : undefined} class="text-sm text-muted-foreground mt-1.5 leading-relaxed italic border-l-2 border-primary/30 pl-3">
|
|
163
|
+
«{source.quote}»
|
|
164
|
+
</p>
|
|
165
|
+
) : (
|
|
166
|
+
<p lang={source.lang && source.lang !== lang ? source.lang : undefined} class="text-sm text-muted-foreground mt-1.5 leading-relaxed italic border-l-2 border-primary/30 pl-3">
|
|
159
167
|
“{source.quote}”
|
|
160
168
|
</p>
|
|
161
|
-
)}
|
|
169
|
+
))}
|
|
162
170
|
</div>
|
|
163
171
|
</li>
|
|
164
172
|
))}
|
package/src/seo/Breadcrumb.astro
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { url } from '@sarimarcus/content-sites-core/url';
|
|
14
14
|
import Icon from '../primitives/Icon.astro';
|
|
15
15
|
import type { BreadcrumbItem } from './types';
|
|
16
|
-
import {
|
|
16
|
+
import { getLabels } from '../internal/labels';
|
|
17
17
|
|
|
18
18
|
interface Props {
|
|
19
19
|
items: BreadcrumbItem[];
|
|
@@ -26,9 +26,12 @@ interface Props {
|
|
|
26
26
|
homeLabel?: string;
|
|
27
27
|
homeHref?: string;
|
|
28
28
|
ariaLabel?: string;
|
|
29
|
+
locale?: string;
|
|
29
30
|
basePath?: string;
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).breadcrumb;
|
|
34
|
+
|
|
32
35
|
const {
|
|
33
36
|
items,
|
|
34
37
|
textColorClass = 'text-muted-foreground',
|
|
@@ -37,9 +40,9 @@ const {
|
|
|
37
40
|
compactMobile = false,
|
|
38
41
|
separator = 'chevron',
|
|
39
42
|
tapTargets = true,
|
|
40
|
-
homeLabel =
|
|
43
|
+
homeLabel = defaultLabels.homeLabel,
|
|
41
44
|
homeHref = '/',
|
|
42
|
-
ariaLabel =
|
|
45
|
+
ariaLabel = defaultLabels.ariaLabel,
|
|
43
46
|
basePath = '/',
|
|
44
47
|
} = Astro.props;
|
|
45
48
|
|
package/src/seo/schemaContext.ts
CHANGED
|
@@ -5,11 +5,12 @@ import path from 'node:path';
|
|
|
5
5
|
* The page half of core `createSchemaContext`'s input, from Astro: site URL (else `fallbackSiteUrl`), base path,
|
|
6
6
|
* page path, and `fileExists` on `public/`.
|
|
7
7
|
*/
|
|
8
|
-
export function astroSchemaInput(astro: { site?: URL; url: URL }, fallbackSiteUrl: string) {
|
|
8
|
+
export function astroSchemaInput(astro: { site?: URL; url: URL }, fallbackSiteUrl: string, inLanguage?: string) {
|
|
9
9
|
return {
|
|
10
10
|
siteUrl: astro.site?.href || fallbackSiteUrl,
|
|
11
11
|
basePath: import.meta.env.BASE_URL.replace(/\/$/, ''),
|
|
12
12
|
pagePath: astro.url.pathname,
|
|
13
13
|
fileExists: (p: string) => fs.existsSync(path.join(process.cwd(), 'public', p)),
|
|
14
|
+
...(inLanguage ? { inLanguage } : {}),
|
|
14
15
|
};
|
|
15
16
|
}
|
package/src/seo/sourceLabels.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export const COMMON_SOURCE_LABELS: Readonly<Record<string, string>> = {
|
|
3
3
|
'wikipedia.org': 'Wikipedia',
|
|
4
4
|
'en.wikipedia.org': 'Wikipedia',
|
|
5
|
+
'it.wikipedia.org': 'Wikipedia',
|
|
5
6
|
'britannica.com': 'Britannica',
|
|
6
7
|
'unesco.org': 'UNESCO',
|
|
7
8
|
'whc.unesco.org': 'UNESCO World Heritage',
|
package/src/seo/types.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface ArticleAuthor {
|
|
|
15
15
|
credentials?: string | null;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export type SourceInput = string | { name?: string; url: string; description?: string; quote?: string };
|
|
18
|
+
export type SourceInput = string | { name?: string; url: string; description?: string; quote?: string; lang?: string };
|
|
19
19
|
|
|
20
20
|
/** Host → outbound class (`competitor`, `affiliate`, …), the synced outbound-domains store, or a function of the URL. */
|
|
21
21
|
export type DomainClassifier = Record<string, string> | OutboundDomainStore | ((url: string) => string);
|