@sarimarcus/content-sites-core 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.
- package/CHANGELOG.md +8 -0
- package/dist/config/siteConfig.js +6 -1
- package/dist/dates/formatDate.d.ts +1 -1
- package/dist/dates/formatDate.js +4 -4
- package/dist/schema/context.js +1 -0
- package/dist/schema/events.js +2 -1
- package/dist/schema/graph.js +2 -2
- package/dist/schema/nodes.d.ts +2 -1
- package/dist/schema/nodes.js +2 -2
- package/dist/schema/pages.js +2 -1
- package/dist/schema/types.d.ts +3 -0
- package/dist/url/relatedZone.d.ts +1 -1
- package/dist/url/relatedZone.js +4 -1
- package/package.json +1 -1
- package/src/config/siteConfig.ts +6 -1
- package/src/dates/formatDate.ts +4 -4
- package/src/schema/context.ts +1 -0
- package/src/schema/events.ts +2 -1
- package/src/schema/graph.ts +2 -2
- package/src/schema/nodes.ts +3 -2
- package/src/schema/pages.ts +2 -1
- package/src/schema/types.ts +3 -0
- package/src/url/relatedZone.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
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
|
+
- Lockstep release, no change (SLA-3756).
|
|
8
|
+
|
|
9
|
+
## 0.54.2 (2026-11-03)
|
|
10
|
+
|
|
11
|
+
- `config`, `dates`, `schema`, `url`: add `SiteConfig.locale` and `getLocale()` (`en-GB` / `it-IT`), locale-aware `formatEditorialDate(iso, locale)` and `relatedZoneLabel(type, lang)`, and dynamic `inLanguage` on JSON-LD `WebSite`, `WebPage`, `CollectionPage`, `Article`, `FAQPage`, and `Event` nodes (SLA-3787).
|
|
12
|
+
|
|
5
13
|
## 0.54.1 (2026-11-02)
|
|
6
14
|
|
|
7
15
|
- `interludes`: `relocateArticleFeature` no longer falls back to the carousel's section when no back-half section is free. It takes a display section with a slot at least two paragraphs from every block (preferring one without a carousel), then the same search over the whole article, so the card stops stacking on the affiliate carousel. Across the 530 articles with a feature card, those landing within a paragraph of another block drop from 79 to 1.
|
|
@@ -109,6 +109,7 @@ export function sitemapSerialize(lastmodMap, mostRecent, { exclude = [], rules =
|
|
|
109
109
|
export function defineSiteConfig(opts) {
|
|
110
110
|
const rootDir = opts.root instanceof URL ? fileURLToPath(opts.root) : opts.root;
|
|
111
111
|
const { lastmodMap, mostRecent } = buildLastmodMap(rootDir, opts.lastmod);
|
|
112
|
+
const lang = opts.language ?? 'en';
|
|
112
113
|
return {
|
|
113
114
|
...(opts.redirects ? { redirects: opts.redirects } : {}),
|
|
114
115
|
site: opts.site,
|
|
@@ -116,6 +117,10 @@ export function defineSiteConfig(opts) {
|
|
|
116
117
|
output: 'static',
|
|
117
118
|
trailingSlash: 'never',
|
|
118
119
|
compressHTML: true,
|
|
120
|
+
i18n: {
|
|
121
|
+
defaultLocale: lang,
|
|
122
|
+
locales: [lang],
|
|
123
|
+
},
|
|
119
124
|
image: {
|
|
120
125
|
// Never encodes: serves the committed variants in image-variants/ (npm run images:variants writes them).
|
|
121
126
|
service: {
|
|
@@ -145,7 +150,7 @@ export function defineSiteConfig(opts) {
|
|
|
145
150
|
opts.pagefind({
|
|
146
151
|
indexConfig: {
|
|
147
152
|
excludeSelectors: [...PAGEFIND_EXCLUDE_SELECTORS],
|
|
148
|
-
forceLanguage:
|
|
153
|
+
forceLanguage: lang,
|
|
149
154
|
},
|
|
150
155
|
}),
|
|
151
156
|
],
|
|
@@ -22,4 +22,4 @@ export declare function formatDisplayDay(iso: string | undefined, locale?: strin
|
|
|
22
22
|
* via `formatUtcDate`: "Aug 12" (single day), "Aug 12–13" (same month),
|
|
23
23
|
* "May 29 – Jun 5" (cross-month). Returns '' when `start` is missing/invalid.
|
|
24
24
|
*/
|
|
25
|
-
export declare function formatUtcDateRange(start?: string, end?: string): string;
|
|
25
|
+
export declare function formatUtcDateRange(start?: string, end?: string, locale?: string): string;
|
package/dist/dates/formatDate.js
CHANGED
|
@@ -39,15 +39,15 @@ export function formatDisplayDay(iso, locale = 'en-GB', timeZone = 'UTC') {
|
|
|
39
39
|
* via `formatUtcDate`: "Aug 12" (single day), "Aug 12–13" (same month),
|
|
40
40
|
* "May 29 – Jun 5" (cross-month). Returns '' when `start` is missing/invalid.
|
|
41
41
|
*/
|
|
42
|
-
export function formatUtcDateRange(start, end) {
|
|
43
|
-
const s = formatUtcDate(start, { month: 'short', day: 'numeric' });
|
|
42
|
+
export function formatUtcDateRange(start, end, locale = 'en-US') {
|
|
43
|
+
const s = formatUtcDate(start, { month: 'short', day: 'numeric' }, locale);
|
|
44
44
|
if (!s)
|
|
45
45
|
return '';
|
|
46
46
|
if (!end || end.length < 10 || end.slice(0, 10) === start.slice(0, 10))
|
|
47
47
|
return s;
|
|
48
|
-
const e = formatUtcDate(end, { month: 'short', day: 'numeric' });
|
|
48
|
+
const e = formatUtcDate(end, { month: 'short', day: 'numeric' }, locale);
|
|
49
49
|
if (!e)
|
|
50
50
|
return s;
|
|
51
51
|
const sameMonth = start.slice(0, 7) === end.slice(0, 7);
|
|
52
|
-
return sameMonth ? `${s}–${formatUtcDate(end, { day: 'numeric' })}` : `${s} – ${e}`;
|
|
52
|
+
return sameMonth ? `${s}–${formatUtcDate(end, { day: 'numeric' }, locale)}` : `${s} – ${e}`;
|
|
53
53
|
}
|
package/dist/schema/context.js
CHANGED
|
@@ -59,6 +59,7 @@ export function createSchemaContext(input) {
|
|
|
59
59
|
pageUrl: toAbsoluteSiteUrl(input.pagePath, siteUrl, basePath),
|
|
60
60
|
orgId: `${siteBaseUrl}#organization`,
|
|
61
61
|
websiteId: `${siteBaseUrl}#website`,
|
|
62
|
+
inLanguage: input.inLanguage || 'en',
|
|
62
63
|
abs: (path) => `${siteUrl}${basePath}${path}`,
|
|
63
64
|
absOrHttp: (path) => (path.startsWith('http') ? path : `${siteUrl}${basePath}${path}`),
|
|
64
65
|
route: (kind, slug) => `${siteUrl}${basePath}/${routeSegment(kind, routes)}/${slug}`,
|
package/dist/schema/events.js
CHANGED
|
@@ -52,8 +52,9 @@ function eventNode(ctx, policy, data, parts) {
|
|
|
52
52
|
}
|
|
53
53
|
/** Event at route `event`, its author's Person first, and a companion Article (SLA-357). */
|
|
54
54
|
export function eventBuilder(options) {
|
|
55
|
-
const { offersArray = false, emitEvent = () => true, articleSection = 'Events', inLanguage
|
|
55
|
+
const { offersArray = false, emitEvent = () => true, articleSection = 'Events', inLanguage: optionInLanguage, currency = 'EUR' } = options;
|
|
56
56
|
return (data, ctx) => {
|
|
57
|
+
const inLanguage = optionInLanguage ?? ctx.inLanguage ?? 'en';
|
|
57
58
|
const { isFree, price } = eventPrice(data);
|
|
58
59
|
const validFrom = offerValidFrom(data.startDate);
|
|
59
60
|
const pageRoute = ctx.route('event', data.slug);
|
package/dist/schema/graph.js
CHANGED
|
@@ -13,7 +13,7 @@ export function buildBreadcrumbList(ctx, breadcrumbs) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
/** The page's WebPage node: name/description/dates fall back to the first entries that carry them. */
|
|
16
|
-
export function buildWebPageNode(ctx, page, inLanguage = 'en') {
|
|
16
|
+
export function buildWebPageNode(ctx, page, inLanguage = ctx.inLanguage ?? 'en') {
|
|
17
17
|
const { entries } = page;
|
|
18
18
|
return {
|
|
19
19
|
'@type': 'WebPage',
|
|
@@ -38,7 +38,7 @@ export function buildWebPageNode(ctx, page, inLanguage = 'en') {
|
|
|
38
38
|
* then each entry's node(s) in call order. A type with no builder, or a builder returning null, emits nothing.
|
|
39
39
|
*/
|
|
40
40
|
export function assembleGraph(ctx, options) {
|
|
41
|
-
const graph = [options.organization, options.website, buildWebPageNode(ctx, options, options.inLanguage)];
|
|
41
|
+
const graph = [options.organization, options.website, buildWebPageNode(ctx, options, options.inLanguage ?? ctx.inLanguage)];
|
|
42
42
|
if (options.breadcrumbs)
|
|
43
43
|
graph.push(buildBreadcrumbList(ctx, options.breadcrumbs));
|
|
44
44
|
options.beforeEntries?.(graph);
|
package/dist/schema/nodes.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare function placeNode(ctx: SchemaContext, data: Record<string, any>,
|
|
|
16
16
|
export interface SiteNodeFields {
|
|
17
17
|
name: string;
|
|
18
18
|
description: string;
|
|
19
|
+
inLanguage?: string;
|
|
19
20
|
}
|
|
20
21
|
export interface OrganizationLogo {
|
|
21
22
|
path: string;
|
|
@@ -25,4 +26,4 @@ export interface OrganizationLogo {
|
|
|
25
26
|
/** The base graph's Organization; `extra` (sameAs, knowsAbout, …) follows the description. */
|
|
26
27
|
export declare function siteOrganizationNode(ctx: SchemaContext, { name, description }: SiteNodeFields, logo?: OrganizationLogo, extra?: JsonLdNode): JsonLdNode;
|
|
27
28
|
/** The base graph's WebSite, published by the Organization; `extra` (a SearchAction, …) follows. */
|
|
28
|
-
export declare function siteWebsiteNode(ctx: SchemaContext, { name, description }: SiteNodeFields, extra?: JsonLdNode): JsonLdNode;
|
|
29
|
+
export declare function siteWebsiteNode(ctx: SchemaContext, { name, description, inLanguage }: SiteNodeFields, extra?: JsonLdNode): JsonLdNode;
|
package/dist/schema/nodes.js
CHANGED
|
@@ -35,14 +35,14 @@ export function siteOrganizationNode(ctx, { name, description }, logo = { path:
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
/** The base graph's WebSite, published by the Organization; `extra` (a SearchAction, …) follows. */
|
|
38
|
-
export function siteWebsiteNode(ctx, { name, description }, extra = {}) {
|
|
38
|
+
export function siteWebsiteNode(ctx, { name, description, inLanguage }, extra = {}) {
|
|
39
39
|
return {
|
|
40
40
|
'@type': 'WebSite',
|
|
41
41
|
'@id': ctx.websiteId,
|
|
42
42
|
name,
|
|
43
43
|
description,
|
|
44
44
|
url: ctx.siteBaseUrl,
|
|
45
|
-
inLanguage: 'en',
|
|
45
|
+
inLanguage: inLanguage ?? ctx.inLanguage ?? 'en',
|
|
46
46
|
publisher: { '@id': ctx.orgId },
|
|
47
47
|
...extra,
|
|
48
48
|
};
|
package/dist/schema/pages.js
CHANGED
|
@@ -23,8 +23,9 @@ export function faqPageBuilder() {
|
|
|
23
23
|
* The FAQPage here keeps question and answer text as given, unlike `faqPageBuilder`.
|
|
24
24
|
*/
|
|
25
25
|
export function articleBuilder(options = {}) {
|
|
26
|
-
const { imageVariants = false, defaultImage = '/og-default.jpg', defaultSection = 'Travel Guide', inLanguage
|
|
26
|
+
const { imageVariants = false, defaultImage = '/og-default.jpg', defaultSection = 'Travel Guide', inLanguage: optionInLanguage, speakableSelectors = ['h1', '.article-lede'], } = options;
|
|
27
27
|
return (data, ctx) => {
|
|
28
|
+
const inLanguage = optionInLanguage ?? ctx.inLanguage ?? 'en';
|
|
28
29
|
const articleImageUrl = data.image ? ctx.resolveImageUrl(data.image, data.slug) : ctx.abs(defaultImage);
|
|
29
30
|
const articleUrl = data.url ? ctx.absOrHttp(data.url) : ctx.pageUrl;
|
|
30
31
|
const author = ctx.resolveAuthor(data.author);
|
package/dist/schema/types.d.ts
CHANGED
|
@@ -51,6 +51,8 @@ export interface SchemaContextInput {
|
|
|
51
51
|
routes?: RouteMap;
|
|
52
52
|
/** Clock for the future-date clamp and `defaultToNow`. */
|
|
53
53
|
now?: () => Date;
|
|
54
|
+
/** BCP-47 language tag for JSON-LD `inLanguage` (defaults to `'en'`). */
|
|
55
|
+
inLanguage?: string;
|
|
54
56
|
}
|
|
55
57
|
export interface SchemaContext {
|
|
56
58
|
siteUrl: string;
|
|
@@ -59,6 +61,7 @@ export interface SchemaContext {
|
|
|
59
61
|
pageUrl: string;
|
|
60
62
|
orgId: string;
|
|
61
63
|
websiteId: string;
|
|
64
|
+
inLanguage: string;
|
|
62
65
|
/** `${siteUrl}${basePath}${path}` for a root-relative path. */
|
|
63
66
|
abs(path: string): string;
|
|
64
67
|
/** A root-relative path made absolute; an `http…` value passes through. */
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
export declare const RELATED_ZONE_ROLES: readonly ["closer"];
|
|
15
15
|
export type RelatedZoneRole = (typeof RELATED_ZONE_ROLES)[number];
|
|
16
16
|
/** `context` is whatever frames the page best: the entity name, its neighborhood name, or a collection noun. */
|
|
17
|
-
export declare function closerHeading(context: string): string;
|
|
17
|
+
export declare function closerHeading(context: string, locale?: string): string;
|
|
18
18
|
/** A guides-collection entry, as getCollection('guides') yields it. */
|
|
19
19
|
type GuideEntry = {
|
|
20
20
|
id: string;
|
package/dist/url/relatedZone.js
CHANGED
|
@@ -14,7 +14,10 @@ import { extractProseHrefs, normalizeHref } from "./relatedDedup.js";
|
|
|
14
14
|
/** The only heading role an entity-page tail may render. */
|
|
15
15
|
export const RELATED_ZONE_ROLES = ['closer'];
|
|
16
16
|
/** `context` is whatever frames the page best: the entity name, its neighborhood name, or a collection noun. */
|
|
17
|
-
export function closerHeading(context) {
|
|
17
|
+
export function closerHeading(context, locale = 'en') {
|
|
18
|
+
if (locale === 'it' || locale.startsWith('it-')) {
|
|
19
|
+
return `Continua a esplorare ${context}`;
|
|
20
|
+
}
|
|
18
21
|
return `Keep exploring ${context}`;
|
|
19
22
|
}
|
|
20
23
|
/**
|
package/package.json
CHANGED
package/src/config/siteConfig.ts
CHANGED
|
@@ -141,6 +141,7 @@ export function sitemapSerialize(
|
|
|
141
141
|
export function defineSiteConfig(opts: SiteConfigOptions): AstroUserConfig {
|
|
142
142
|
const rootDir = opts.root instanceof URL ? fileURLToPath(opts.root) : opts.root;
|
|
143
143
|
const { lastmodMap, mostRecent } = buildLastmodMap(rootDir, opts.lastmod);
|
|
144
|
+
const lang = opts.language ?? 'en';
|
|
144
145
|
return {
|
|
145
146
|
...(opts.redirects ? { redirects: opts.redirects } : {}),
|
|
146
147
|
site: opts.site,
|
|
@@ -148,6 +149,10 @@ export function defineSiteConfig(opts: SiteConfigOptions): AstroUserConfig {
|
|
|
148
149
|
output: 'static',
|
|
149
150
|
trailingSlash: 'never',
|
|
150
151
|
compressHTML: true,
|
|
152
|
+
i18n: {
|
|
153
|
+
defaultLocale: lang,
|
|
154
|
+
locales: [lang],
|
|
155
|
+
},
|
|
151
156
|
image: {
|
|
152
157
|
// Never encodes: serves the committed variants in image-variants/ (npm run images:variants writes them).
|
|
153
158
|
service: {
|
|
@@ -177,7 +182,7 @@ export function defineSiteConfig(opts: SiteConfigOptions): AstroUserConfig {
|
|
|
177
182
|
opts.pagefind({
|
|
178
183
|
indexConfig: {
|
|
179
184
|
excludeSelectors: [...PAGEFIND_EXCLUDE_SELECTORS],
|
|
180
|
-
forceLanguage:
|
|
185
|
+
forceLanguage: lang,
|
|
181
186
|
},
|
|
182
187
|
}),
|
|
183
188
|
],
|
package/src/dates/formatDate.ts
CHANGED
|
@@ -41,12 +41,12 @@ export function formatDisplayDay(iso: string | undefined, locale: string = 'en-G
|
|
|
41
41
|
* via `formatUtcDate`: "Aug 12" (single day), "Aug 12–13" (same month),
|
|
42
42
|
* "May 29 – Jun 5" (cross-month). Returns '' when `start` is missing/invalid.
|
|
43
43
|
*/
|
|
44
|
-
export function formatUtcDateRange(start?: string, end?: string): string {
|
|
45
|
-
const s = formatUtcDate(start, { month: 'short', day: 'numeric' });
|
|
44
|
+
export function formatUtcDateRange(start?: string, end?: string, locale: string = 'en-US'): string {
|
|
45
|
+
const s = formatUtcDate(start, { month: 'short', day: 'numeric' }, locale);
|
|
46
46
|
if (!s) return '';
|
|
47
47
|
if (!end || end.length < 10 || end.slice(0, 10) === start!.slice(0, 10)) return s;
|
|
48
|
-
const e = formatUtcDate(end, { month: 'short', day: 'numeric' });
|
|
48
|
+
const e = formatUtcDate(end, { month: 'short', day: 'numeric' }, locale);
|
|
49
49
|
if (!e) return s;
|
|
50
50
|
const sameMonth = start!.slice(0, 7) === end.slice(0, 7);
|
|
51
|
-
return sameMonth ? `${s}–${formatUtcDate(end, { day: 'numeric' })}` : `${s} – ${e}`;
|
|
51
|
+
return sameMonth ? `${s}–${formatUtcDate(end, { day: 'numeric' }, locale)}` : `${s} – ${e}`;
|
|
52
52
|
}
|
package/src/schema/context.ts
CHANGED
|
@@ -63,6 +63,7 @@ export function createSchemaContext(input: SchemaContextInput): SchemaContext {
|
|
|
63
63
|
pageUrl: toAbsoluteSiteUrl(input.pagePath, siteUrl, basePath),
|
|
64
64
|
orgId: `${siteBaseUrl}#organization`,
|
|
65
65
|
websiteId: `${siteBaseUrl}#website`,
|
|
66
|
+
inLanguage: input.inLanguage || 'en',
|
|
66
67
|
abs: (path) => `${siteUrl}${basePath}${path}`,
|
|
67
68
|
absOrHttp: (path) => (path.startsWith('http') ? path : `${siteUrl}${basePath}${path}`),
|
|
68
69
|
route: (kind, slug) => `${siteUrl}${basePath}/${routeSegment(kind, routes)}/${slug}`,
|
package/src/schema/events.ts
CHANGED
|
@@ -91,8 +91,9 @@ export interface EventOptions extends EventPolicy {
|
|
|
91
91
|
|
|
92
92
|
/** Event at route `event`, its author's Person first, and a companion Article (SLA-357). */
|
|
93
93
|
export function eventBuilder(options: EventOptions): SchemaBuilder {
|
|
94
|
-
const { offersArray = false, emitEvent = () => true, articleSection = 'Events', inLanguage
|
|
94
|
+
const { offersArray = false, emitEvent = () => true, articleSection = 'Events', inLanguage: optionInLanguage, currency = 'EUR' } = options;
|
|
95
95
|
return (data, ctx) => {
|
|
96
|
+
const inLanguage = optionInLanguage ?? ctx.inLanguage ?? 'en';
|
|
96
97
|
const { isFree, price } = eventPrice(data);
|
|
97
98
|
const validFrom = offerValidFrom(data.startDate);
|
|
98
99
|
const pageRoute = ctx.route('event', data.slug);
|
package/src/schema/graph.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface PageInput {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/** The page's WebPage node: name/description/dates fall back to the first entries that carry them. */
|
|
33
|
-
export function buildWebPageNode(ctx: SchemaContext, page: PageInput, inLanguage = 'en'): JsonLdNode {
|
|
33
|
+
export function buildWebPageNode(ctx: SchemaContext, page: PageInput, inLanguage = ctx.inLanguage ?? 'en'): JsonLdNode {
|
|
34
34
|
const { entries } = page;
|
|
35
35
|
return {
|
|
36
36
|
'@type': 'WebPage',
|
|
@@ -69,7 +69,7 @@ export interface AssembleOptions extends PageInput {
|
|
|
69
69
|
* then each entry's node(s) in call order. A type with no builder, or a builder returning null, emits nothing.
|
|
70
70
|
*/
|
|
71
71
|
export function assembleGraph(ctx: SchemaContext, options: AssembleOptions): JsonLdNode[] {
|
|
72
|
-
const graph: JsonLdNode[] = [options.organization, options.website, buildWebPageNode(ctx, options, options.inLanguage)];
|
|
72
|
+
const graph: JsonLdNode[] = [options.organization, options.website, buildWebPageNode(ctx, options, options.inLanguage ?? ctx.inLanguage)];
|
|
73
73
|
if (options.breadcrumbs) graph.push(buildBreadcrumbList(ctx, options.breadcrumbs));
|
|
74
74
|
options.beforeEntries?.(graph);
|
|
75
75
|
for (const { type, data } of options.entries) {
|
package/src/schema/nodes.ts
CHANGED
|
@@ -39,6 +39,7 @@ export function placeNode(
|
|
|
39
39
|
export interface SiteNodeFields {
|
|
40
40
|
name: string;
|
|
41
41
|
description: string;
|
|
42
|
+
inLanguage?: string;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
export interface OrganizationLogo {
|
|
@@ -70,14 +71,14 @@ export function siteOrganizationNode(
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/** The base graph's WebSite, published by the Organization; `extra` (a SearchAction, …) follows. */
|
|
73
|
-
export function siteWebsiteNode(ctx: SchemaContext, { name, description }: SiteNodeFields, extra: JsonLdNode = {}): JsonLdNode {
|
|
74
|
+
export function siteWebsiteNode(ctx: SchemaContext, { name, description, inLanguage }: SiteNodeFields, extra: JsonLdNode = {}): JsonLdNode {
|
|
74
75
|
return {
|
|
75
76
|
'@type': 'WebSite',
|
|
76
77
|
'@id': ctx.websiteId,
|
|
77
78
|
name,
|
|
78
79
|
description,
|
|
79
80
|
url: ctx.siteBaseUrl,
|
|
80
|
-
inLanguage: 'en',
|
|
81
|
+
inLanguage: inLanguage ?? ctx.inLanguage ?? 'en',
|
|
81
82
|
publisher: { '@id': ctx.orgId },
|
|
82
83
|
...extra,
|
|
83
84
|
};
|
package/src/schema/pages.ts
CHANGED
|
@@ -40,10 +40,11 @@ export function articleBuilder(options: ArticleOptions = {}): SchemaBuilder {
|
|
|
40
40
|
imageVariants = false,
|
|
41
41
|
defaultImage = '/og-default.jpg',
|
|
42
42
|
defaultSection = 'Travel Guide',
|
|
43
|
-
inLanguage
|
|
43
|
+
inLanguage: optionInLanguage,
|
|
44
44
|
speakableSelectors = ['h1', '.article-lede'],
|
|
45
45
|
} = options;
|
|
46
46
|
return (data, ctx) => {
|
|
47
|
+
const inLanguage = optionInLanguage ?? ctx.inLanguage ?? 'en';
|
|
47
48
|
const articleImageUrl = data.image ? ctx.resolveImageUrl(data.image, data.slug) : ctx.abs(defaultImage);
|
|
48
49
|
const articleUrl = data.url ? ctx.absOrHttp(data.url) : ctx.pageUrl;
|
|
49
50
|
const author = ctx.resolveAuthor(data.author);
|
package/src/schema/types.ts
CHANGED
|
@@ -58,6 +58,8 @@ export interface SchemaContextInput {
|
|
|
58
58
|
routes?: RouteMap;
|
|
59
59
|
/** Clock for the future-date clamp and `defaultToNow`. */
|
|
60
60
|
now?: () => Date;
|
|
61
|
+
/** BCP-47 language tag for JSON-LD `inLanguage` (defaults to `'en'`). */
|
|
62
|
+
inLanguage?: string;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
export interface SchemaContext {
|
|
@@ -67,6 +69,7 @@ export interface SchemaContext {
|
|
|
67
69
|
pageUrl: string;
|
|
68
70
|
orgId: string;
|
|
69
71
|
websiteId: string;
|
|
72
|
+
inLanguage: string;
|
|
70
73
|
/** `${siteUrl}${basePath}${path}` for a root-relative path. */
|
|
71
74
|
abs(path: string): string;
|
|
72
75
|
/** A root-relative path made absolute; an `http…` value passes through. */
|
package/src/url/relatedZone.ts
CHANGED
|
@@ -18,7 +18,10 @@ export const RELATED_ZONE_ROLES = ['closer'] as const;
|
|
|
18
18
|
export type RelatedZoneRole = (typeof RELATED_ZONE_ROLES)[number];
|
|
19
19
|
|
|
20
20
|
/** `context` is whatever frames the page best: the entity name, its neighborhood name, or a collection noun. */
|
|
21
|
-
export function closerHeading(context: string): string {
|
|
21
|
+
export function closerHeading(context: string, locale: string = 'en'): string {
|
|
22
|
+
if (locale === 'it' || locale.startsWith('it-')) {
|
|
23
|
+
return `Continua a esplorare ${context}`;
|
|
24
|
+
}
|
|
22
25
|
return `Keep exploring ${context}`;
|
|
23
26
|
}
|
|
24
27
|
|