@sarimarcus/content-sites-tourism 0.31.7 → 0.32.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 +9 -0
- package/package.json +3 -4
- package/src/cards/EventCard.astro +16 -8
- package/src/internal/labels.ts +32 -0
- package/src/schema/builders.ts +31 -97
- package/src/schema/index.ts +2 -5
- package/src/sections/ArticleCardGrid.astro +6 -3
- package/src/sections/HomeTripPlanner.astro +2 -1
- package/src/sections/ItineraryTeaser.astro +7 -3
- package/src/sections/MonumentBodySlot.astro +3 -2
- package/src/sections/RankedListingRow.astro +3 -2
- package/src/sections/WalkStops.astro +10 -12
- package/src/sections/WhoItsFor.astro +2 -1
- package/src/types/index.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.32.0 (2026-10-09)
|
|
6
|
+
|
|
7
|
+
- Optional EventCard `unescoLabel`, `freeLabel`, `ctaLabel`, `typeLabels`, `fallbackTypeLabel`; WalkStops `typeLabels`; optional `routes` on ArticleCardGrid and ItineraryTeaser. Defaults keep today's output (SLA-2991).
|
|
8
|
+
|
|
9
|
+
### Breaking
|
|
10
|
+
|
|
11
|
+
- `./types` is removed (it exported nothing) (SLA-2991).
|
|
12
|
+
- `monumentBuilder`, `museumBuilder`, `restaurantBuilder`, `barBuilder`, `dishBuilder`, `neighborhoodBuilder`, `GUIDE_ITEM_TYPES`, `MonumentOptions`, `RestaurantOptions`, `BarOptions`, `DishOptions` and the never-set option fields (`touristType`, `menuSectionName`, `tapasCuisine`, `articleSection`, `inLanguage`, `guideItemListBuilder` `itemTypes`) are removed (deprecated in 0.31.4); `tourismCityBuilders(city)` builds every one, and JSON-LD is unchanged. `TouristTripOptions` stays. `scripts/platform/migrations/remove-deprecated.mjs` asserts no call site (SLA-2991).
|
|
13
|
+
|
|
5
14
|
## 0.31.7 (2026-10-09)
|
|
6
15
|
|
|
7
16
|
- `./cards` `NeighborhoodCard`: the CTA arrow draws through ui `ArrowGlyph` (the svg loses its scoped `data-astro-cid-*` attributes) and the monuments glyph is ui `Icon` `building`. `MonumentCard`/`MuseumCard`: the highlight star is ui `Icon` `star` filled, Lucide's rounded star. `./sections` `NeighborhoodCategory`: the historic and modern header glyphs are ui `Icon` `landmark` (the arcade becomes a temple) and `newspaper`. Pages: `index`, `monuments`, `monuments/type/*`, `neighborhoods` and the `neighborhood/` pages with starred monument cards on both tourism sites, svg only (SLA-3024).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-tourism",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "City-tourism vertical: city-entity components, pages templates and utilities for the tourism sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,13 +30,12 @@
|
|
|
30
30
|
"./sections": "./src/sections/index.ts",
|
|
31
31
|
"./templates": "./src/templates/index.ts",
|
|
32
32
|
"./schema": "./src/schema/index.ts",
|
|
33
|
-
"./types": "./src/types/index.ts",
|
|
34
33
|
"./tailwind.css": "./src/tailwind.css"
|
|
35
34
|
},
|
|
36
35
|
"peerDependencies": {
|
|
37
36
|
"astro": "^7.0.6",
|
|
38
37
|
"tailwindcss": "^4.1.18",
|
|
39
|
-
"@sarimarcus/content-sites-core": "0.
|
|
40
|
-
"@sarimarcus/content-sites-ui": "0.
|
|
38
|
+
"@sarimarcus/content-sites-core": "0.32.0",
|
|
39
|
+
"@sarimarcus/content-sites-ui": "0.32.0"
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { ImageMetadata } from 'astro';
|
|
8
8
|
import { ArrowLabel, Badge, Icon } from '@sarimarcus/content-sites-ui/primitives';
|
|
9
9
|
import { EntityCard } from '@sarimarcus/content-sites-ui/composed';
|
|
10
|
+
import { LABELS } from '../internal/labels';
|
|
10
11
|
|
|
11
12
|
interface Props {
|
|
12
13
|
href: string;
|
|
@@ -28,6 +29,12 @@ interface Props {
|
|
|
28
29
|
class?: string;
|
|
29
30
|
priority?: boolean; // Explicit LCP priority
|
|
30
31
|
eager?: number; // How many eager loads (default 1)
|
|
32
|
+
unescoLabel?: string;
|
|
33
|
+
freeLabel?: string;
|
|
34
|
+
ctaLabel?: string;
|
|
35
|
+
/** Event `type` → its name; an unknown type shows `fallbackTypeLabel`. */
|
|
36
|
+
typeLabels?: Record<string, string>;
|
|
37
|
+
fallbackTypeLabel?: string;
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
const {
|
|
@@ -48,6 +55,11 @@ const {
|
|
|
48
55
|
class: className,
|
|
49
56
|
priority = false,
|
|
50
57
|
eager = 1,
|
|
58
|
+
unescoLabel = LABELS.eventCard.unescoLabel,
|
|
59
|
+
freeLabel = LABELS.eventCard.freeLabel,
|
|
60
|
+
ctaLabel = LABELS.eventCard.ctaLabel,
|
|
61
|
+
typeLabels = LABELS.eventCard.typeLabels,
|
|
62
|
+
fallbackTypeLabel = LABELS.eventCard.fallbackTypeLabel,
|
|
51
63
|
} = Astro.props;
|
|
52
64
|
|
|
53
65
|
const isUNESCO = tags.includes('unesco');
|
|
@@ -62,8 +74,7 @@ const typeColors: Record<string, string> = {
|
|
|
62
74
|
};
|
|
63
75
|
const typeColor = typeColors[type] || 'bg-shadow text-chalk';
|
|
64
76
|
const labels = tagLabels.slice(0, 3);
|
|
65
|
-
const
|
|
66
|
-
const typeLabel = typeLabels[type] ?? 'Event';
|
|
77
|
+
const typeLabel = typeLabels[type] ?? fallbackTypeLabel;
|
|
67
78
|
---
|
|
68
79
|
|
|
69
80
|
<EntityCard variant="poster" mediaClass="h-48 sm:h-56" href={href} image={image} fallbackSrc={fallbackSrc} imageAlt={imageAlt} index={index} eager={eager} priority={priority} class={className}>
|
|
@@ -80,11 +91,10 @@ const typeLabel = typeLabels[type] ?? 'Event';
|
|
|
80
91
|
<div class="flex flex-wrap gap-1.5 mb-3">
|
|
81
92
|
{isUNESCO && (
|
|
82
93
|
<Badge tone="custom" toneClass="bg-accent-strong/10 text-accent-strong" size="sm" lines={1}>
|
|
83
|
-
<Icon name="star" filled class="w-3 h-3 inline-block align-[-1px] mr-1" aria-hidden="true" />
|
|
84
|
-
</Badge>
|
|
94
|
+
<Icon name="star" filled class="w-3 h-3 inline-block align-[-1px] mr-1" aria-hidden="true" />{`${unescoLabel}\n`}</Badge>
|
|
85
95
|
)}
|
|
86
96
|
{isFree && (
|
|
87
|
-
<Badge tone="custom" toneClass="bg-secondary/10 text-secondary" size="sm" lines={1}>
|
|
97
|
+
<Badge tone="custom" toneClass="bg-secondary/10 text-secondary" size="sm" lines={1}>{freeLabel}</Badge>
|
|
88
98
|
)}
|
|
89
99
|
</div>
|
|
90
100
|
)}
|
|
@@ -121,7 +131,5 @@ const typeLabel = typeLabels[type] ?? 'Event';
|
|
|
121
131
|
{typeLabel}
|
|
122
132
|
</span>
|
|
123
133
|
|
|
124
|
-
<ArrowLabel slot="footer-cta" class="text-sm font-medium text-primary group-hover:text-primary-strong transition-colors">
|
|
125
|
-
Discover
|
|
126
|
-
</ArrowLabel>
|
|
134
|
+
<ArrowLabel slot="footer-cta" class="text-sm font-medium text-primary group-hover:text-primary-strong transition-colors">{`\n${ctaLabel}\n`}</ArrowLabel>
|
|
127
135
|
</EntityCard>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// The English copy tourism components fall back to when the site passes no prop (SLA-2991). A template never writes
|
|
2
|
+
// reader-visible text itself (validate-packages refuses it); it reads a prop whose default is here.
|
|
3
|
+
export const LABELS = {
|
|
4
|
+
articleCardGrid: { readLabel: 'Read', updatedLabel: 'Updated' },
|
|
5
|
+
homeTripPlanner: { eyebrow: 'Build your trip', heading: 'What shape is your visit taking?' },
|
|
6
|
+
itineraryTeaser: { badgeLabel: 'Suggested itinerary' },
|
|
7
|
+
rankedListingRow: { ctaLabel: 'Read more', ratingSuffix: 'out of 5' },
|
|
8
|
+
walkStops: {
|
|
9
|
+
heading: 'Stop-by-Stop Route',
|
|
10
|
+
tipLabel: 'Tip:',
|
|
11
|
+
typeLabels: {
|
|
12
|
+
monument: 'Monument',
|
|
13
|
+
museum: 'Museum',
|
|
14
|
+
restaurant: 'Restaurant',
|
|
15
|
+
bar: 'Bar',
|
|
16
|
+
neighborhood: 'Neighborhood',
|
|
17
|
+
activity: 'Activity',
|
|
18
|
+
dish: 'Dish',
|
|
19
|
+
event: 'Event',
|
|
20
|
+
landmark: 'Landmark',
|
|
21
|
+
} as Record<string, string>,
|
|
22
|
+
},
|
|
23
|
+
whoItsFor: { label: "Who it's for", ariaLabel: 'Related audiences and themes' },
|
|
24
|
+
eventCard: {
|
|
25
|
+
unescoLabel: 'UNESCO',
|
|
26
|
+
freeLabel: 'Free',
|
|
27
|
+
ctaLabel: 'Discover',
|
|
28
|
+
typeLabels: { festival: 'Festival', feria: 'Feria', gastronomie: 'Gastronomy', religieux: 'Tradition' } as Record<string, string>,
|
|
29
|
+
fallbackTypeLabel: 'Event',
|
|
30
|
+
},
|
|
31
|
+
monumentBodySlot: { didYouKnow: 'Did you know?', timeline: 'Timeline' },
|
|
32
|
+
};
|
package/src/schema/builders.ts
CHANGED
|
@@ -5,35 +5,21 @@ import {
|
|
|
5
5
|
import type { JsonLdNode, SchemaBuilder, SchemaBuilders } from '@sarimarcus/content-sites-core/schema';
|
|
6
6
|
import { cityAddressPolicy, type TourismCity } from './city.ts';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
city
|
|
11
|
-
/** @deprecated No caller sets it; the node keeps `touristType: 'Cultural'`. Removed in the next minor (SLA-3020). */
|
|
12
|
-
touristType?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* TouristAttraction at route `monument`; hours from the free-text `hours` line.
|
|
17
|
-
* @deprecated No site imports it; use `tourismCityBuilders(city)`. Removed in the next minor (SLA-3020).
|
|
18
|
-
*/
|
|
19
|
-
export function monumentBuilder(options: MonumentOptions): SchemaBuilder {
|
|
20
|
-
const address = cityAddressPolicy(options.city);
|
|
21
|
-
const touristType = options.touristType ?? 'Cultural';
|
|
8
|
+
/** TouristAttraction at route `monument`; hours from the free-text `hours` line. */
|
|
9
|
+
function monumentBuilder(city: TourismCity): SchemaBuilder {
|
|
10
|
+
const address = cityAddressPolicy(city);
|
|
22
11
|
return (data, ctx) => placeNode(ctx, data, 'TouristAttraction', 'monument', {
|
|
23
12
|
address: postalAddress(address, data, { street: data.address, postalCode: postalCodeOf(data) }),
|
|
24
13
|
geo: geoCoordinates(data.coordinates),
|
|
25
14
|
openingHoursSpecification: parseHoursString(data.hours),
|
|
26
15
|
isAccessibleForFree: isFreeEntry(data, 'fees'),
|
|
27
|
-
touristType,
|
|
16
|
+
touristType: 'Cultural',
|
|
28
17
|
});
|
|
29
18
|
}
|
|
30
19
|
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*/
|
|
35
|
-
export function museumBuilder(options: { city: TourismCity }): SchemaBuilder {
|
|
36
|
-
const address = cityAddressPolicy(options.city);
|
|
20
|
+
/** Museum at route `museum`; hours from the free-text `hours` line. */
|
|
21
|
+
function museumBuilder(city: TourismCity): SchemaBuilder {
|
|
22
|
+
const address = cityAddressPolicy(city);
|
|
37
23
|
return (data, ctx) => placeNode(ctx, data, 'Museum', 'museum', {
|
|
38
24
|
address: postalAddress(address, data, { street: data.address, postalCode: postalCodeOf(data) }),
|
|
39
25
|
geo: geoCoordinates(data.coordinates),
|
|
@@ -52,20 +38,9 @@ const menu = (sectionName: string, items: string[] | undefined): JsonLdNode | un
|
|
|
52
38
|
},
|
|
53
39
|
} : undefined);
|
|
54
40
|
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
city
|
|
58
|
-
/** @deprecated No caller sets it; the menu section stays 'Specialties'. Removed in the next minor (SLA-3020). */
|
|
59
|
-
menuSectionName?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Restaurant at route `restaurant`; `specialties` become its menu.
|
|
64
|
-
* @deprecated No site imports it; use `tourismCityBuilders(city)`. Removed in the next minor (SLA-3020).
|
|
65
|
-
*/
|
|
66
|
-
export function restaurantBuilder(options: RestaurantOptions): SchemaBuilder {
|
|
67
|
-
const address = cityAddressPolicy(options.city);
|
|
68
|
-
const sectionName = options.menuSectionName ?? 'Specialties';
|
|
41
|
+
/** Restaurant at route `restaurant`; `specialties` become its menu. */
|
|
42
|
+
function restaurantBuilder(city: TourismCity): SchemaBuilder {
|
|
43
|
+
const address = cityAddressPolicy(city);
|
|
69
44
|
return (data, ctx) => placeNode(ctx, data, 'Restaurant', 'restaurant', {
|
|
70
45
|
address: postalAddress(address, data, { street: data.address, postalCode: postalCodeOf(data) }),
|
|
71
46
|
servesCuisine: data.cuisine,
|
|
@@ -75,57 +50,28 @@ export function restaurantBuilder(options: RestaurantOptions): SchemaBuilder {
|
|
|
75
50
|
aggregateRating: aggregateRating(data),
|
|
76
51
|
geo: geoCoordinates(data.coordinates),
|
|
77
52
|
sameAs: data.website ? [data.website] : undefined,
|
|
78
|
-
hasMenu: menu(
|
|
53
|
+
hasMenu: menu('Specialties', data.specialties),
|
|
79
54
|
});
|
|
80
55
|
}
|
|
81
56
|
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
-
city
|
|
85
|
-
/** @deprecated No caller sets it; the menu section stays 'Signature Drinks'. Removed in the next minor (SLA-3020). */
|
|
86
|
-
menuSectionName?: string;
|
|
87
|
-
/**
|
|
88
|
-
* `servesCuisine` for a bar whose `category` is `tapas`.
|
|
89
|
-
* @deprecated No caller sets it; it stays 'Tapas'. Removed in the next minor (SLA-3020).
|
|
90
|
-
*/
|
|
91
|
-
tapasCuisine?: string;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* BarOrPub at route `bar`; `specialties` become its drinks menu.
|
|
96
|
-
* @deprecated No site imports it; use `tourismCityBuilders(city)`. Removed in the next minor (SLA-3020).
|
|
97
|
-
*/
|
|
98
|
-
export function barBuilder(options: BarOptions): SchemaBuilder {
|
|
99
|
-
const address = cityAddressPolicy(options.city);
|
|
100
|
-
const sectionName = options.menuSectionName ?? 'Signature Drinks';
|
|
101
|
-
const tapas = options.tapasCuisine ?? 'Tapas';
|
|
57
|
+
/** BarOrPub at route `bar`; `specialties` become its drinks menu. */
|
|
58
|
+
function barBuilder(city: TourismCity): SchemaBuilder {
|
|
59
|
+
const address = cityAddressPolicy(city);
|
|
102
60
|
return (data, ctx) => placeNode(ctx, data, 'BarOrPub', 'bar', {
|
|
103
61
|
address: postalAddress(address, data, { street: data.address, postalCode: postalCodeOf(data) }),
|
|
104
62
|
geo: geoCoordinates(data.coordinates),
|
|
105
63
|
priceRange: normalizePriceRange(data.averagePrice, data.priceFrom),
|
|
106
64
|
aggregateRating: aggregateRating(data),
|
|
107
65
|
sameAs: data.website ? [data.website] : undefined,
|
|
108
|
-
servesCuisine: data.category === 'tapas' ?
|
|
109
|
-
hasMenu: menu(
|
|
66
|
+
servesCuisine: data.category === 'tapas' ? 'Tapas' : undefined,
|
|
67
|
+
hasMenu: menu('Signature Drinks', data.specialties),
|
|
110
68
|
openingHoursSpecification: generateOpeningHours(data.openingHours),
|
|
111
69
|
telephone: data.phone,
|
|
112
70
|
});
|
|
113
71
|
}
|
|
114
72
|
|
|
115
|
-
/**
|
|
116
|
-
|
|
117
|
-
/** @deprecated No caller sets it; it stays 'Gastronomy'. Removed in the next minor (SLA-3020). */
|
|
118
|
-
articleSection?: string;
|
|
119
|
-
/** @deprecated No caller sets it; it stays 'en'. Removed in the next minor (SLA-3020). */
|
|
120
|
-
inLanguage?: string;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* A dish page as an Article at route `dish`, dated by `dateModified` (now when absent).
|
|
125
|
-
* @deprecated No site imports it; use `tourismCityBuilders(city)`. Removed in the next minor (SLA-3020).
|
|
126
|
-
*/
|
|
127
|
-
export function dishBuilder(options: DishOptions = {}): SchemaBuilder {
|
|
128
|
-
const { articleSection = 'Gastronomy', inLanguage = 'en' } = options;
|
|
73
|
+
/** A dish page as an Article at route `dish`, dated by `dateModified` (now when absent). */
|
|
74
|
+
function dishBuilder(): SchemaBuilder {
|
|
129
75
|
return (data, ctx) => {
|
|
130
76
|
const author = ctx.resolveAuthor(data.author);
|
|
131
77
|
const node: JsonLdNode = {
|
|
@@ -139,20 +85,16 @@ export function dishBuilder(options: DishOptions = {}): SchemaBuilder {
|
|
|
139
85
|
datePublished: ctx.formatDate(data.dateModified, true),
|
|
140
86
|
dateModified: ctx.formatDate(data.dateModified, true),
|
|
141
87
|
keywords: data.tags?.join(', ') || '',
|
|
142
|
-
articleSection,
|
|
143
|
-
inLanguage,
|
|
88
|
+
articleSection: 'Gastronomy',
|
|
89
|
+
inLanguage: 'en',
|
|
144
90
|
url: ctx.route('dish', data.slug),
|
|
145
91
|
};
|
|
146
92
|
return author ? [createPersonSchema(author), node] : node;
|
|
147
93
|
};
|
|
148
94
|
}
|
|
149
95
|
|
|
150
|
-
/**
|
|
151
|
-
|
|
152
|
-
* @deprecated No site imports it; use `tourismCityBuilders(city)`. Removed in the next minor (SLA-3020).
|
|
153
|
-
*/
|
|
154
|
-
export function neighborhoodBuilder(options: { city: TourismCity }): SchemaBuilder {
|
|
155
|
-
const { city } = options;
|
|
96
|
+
/** Place at route `neighborhood`, inside the city; pinned to the city when it has no coordinates. */
|
|
97
|
+
function neighborhoodBuilder(city: TourismCity): SchemaBuilder {
|
|
156
98
|
const address = cityAddressPolicy(city);
|
|
157
99
|
return (data, ctx) => placeNode(ctx, data, 'Place', 'neighborhood', {
|
|
158
100
|
address: postalAddress(address, data),
|
|
@@ -198,22 +140,19 @@ export function touristTripBuilder(options: TouristTripOptions = {}): SchemaBuil
|
|
|
198
140
|
/** The entity builders every city guide shares, all addressed in `city`. */
|
|
199
141
|
export function tourismCityBuilders(city: TourismCity): SchemaBuilders {
|
|
200
142
|
return {
|
|
201
|
-
monument: monumentBuilder(
|
|
202
|
-
museum: museumBuilder(
|
|
203
|
-
restaurant: restaurantBuilder(
|
|
204
|
-
bar: barBuilder(
|
|
143
|
+
monument: monumentBuilder(city),
|
|
144
|
+
museum: museumBuilder(city),
|
|
145
|
+
restaurant: restaurantBuilder(city),
|
|
146
|
+
bar: barBuilder(city),
|
|
205
147
|
dish: dishBuilder(),
|
|
206
|
-
neighborhood: neighborhoodBuilder(
|
|
148
|
+
neighborhood: neighborhoodBuilder(city),
|
|
207
149
|
hotel: hotelBuilder({ address: cityAddressPolicy(city) }),
|
|
208
150
|
touristTrip: touristTripBuilder(),
|
|
209
151
|
};
|
|
210
152
|
}
|
|
211
153
|
|
|
212
|
-
/**
|
|
213
|
-
|
|
214
|
-
* @deprecated No site imports it; `guideItemListBuilder` applies it by default. Removed in the next minor (SLA-3020).
|
|
215
|
-
*/
|
|
216
|
-
export const GUIDE_ITEM_TYPES: Record<string, string> = {
|
|
154
|
+
/** Guide item `type` (a plural collection name) → schema type (SLA-2468). */
|
|
155
|
+
const GUIDE_ITEM_TYPES: Record<string, string> = {
|
|
217
156
|
restaurants: 'Restaurant',
|
|
218
157
|
hotels: 'LodgingBusiness',
|
|
219
158
|
monuments: 'TouristAttraction',
|
|
@@ -230,16 +169,11 @@ export const GUIDE_ITEM_TYPES: Record<string, string> = {
|
|
|
230
169
|
* A ranked guide as an ItemList of mixed-type nested entities. Event nests address and geo under `location`;
|
|
231
170
|
* TouristTrip carries no `geo`; hotels carry a price range and no hours.
|
|
232
171
|
*/
|
|
233
|
-
export function guideItemListBuilder(options: {
|
|
234
|
-
city: TourismCity;
|
|
235
|
-
/** @deprecated No caller sets it; the map stays `GUIDE_ITEM_TYPES`. Removed in the next minor (SLA-3020). */
|
|
236
|
-
itemTypes?: Record<string, string>;
|
|
237
|
-
}): SchemaBuilder {
|
|
172
|
+
export function guideItemListBuilder(options: { city: TourismCity }): SchemaBuilder {
|
|
238
173
|
const policy = cityAddressPolicy(options.city);
|
|
239
|
-
const itemTypes = options.itemTypes ?? GUIDE_ITEM_TYPES;
|
|
240
174
|
return (data, ctx) => {
|
|
241
175
|
const nested = (item: any): JsonLdNode => {
|
|
242
|
-
const schemaType =
|
|
176
|
+
const schemaType = GUIDE_ITEM_TYPES[item.type] ?? 'WebPage';
|
|
243
177
|
const entity: JsonLdNode = {
|
|
244
178
|
'@type': schemaType,
|
|
245
179
|
name: item.name,
|
package/src/schema/index.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
// Public surface of @sarimarcus/content-sites-tourism/schema: city-entity JSON-LD builders on core `schema`.
|
|
2
2
|
export { cityAddressPolicy, cityDestinationFields, cityEventPolicy, organization } from './city.ts';
|
|
3
3
|
export type { TourismCity, CityEventOptions } from './city.ts';
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
guideItemListBuilder, GUIDE_ITEM_TYPES, touristTripBuilder, tourismCityBuilders,
|
|
7
|
-
} from './builders.ts';
|
|
8
|
-
export type { MonumentOptions, RestaurantOptions, BarOptions, DishOptions, TouristTripOptions } from './builders.ts';
|
|
4
|
+
export { guideItemListBuilder, touristTripBuilder, tourismCityBuilders } from './builders.ts';
|
|
5
|
+
export type { TouristTripOptions } from './builders.ts';
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { ImageMetadata } from 'astro';
|
|
7
7
|
import { ArticleGrid } from '@sarimarcus/content-sites-ui/editorial';
|
|
8
|
-
import { url } from '@sarimarcus/content-sites-core/url';
|
|
8
|
+
import { routePath, url, type SiteRoutes } from '@sarimarcus/content-sites-core/url';
|
|
9
|
+
import { LABELS } from '../internal/labels';
|
|
9
10
|
|
|
10
11
|
export interface ArticleCardGridEntry {
|
|
11
12
|
data: {
|
|
@@ -26,9 +27,11 @@ interface Props {
|
|
|
26
27
|
timeZone?: string;
|
|
27
28
|
readLabel?: string;
|
|
28
29
|
updatedLabel?: string;
|
|
30
|
+
/** Overrides of the `articles` route. */
|
|
31
|
+
routes?: SiteRoutes;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
const { articles, articleImages, timeZone = 'Europe/Madrid', readLabel =
|
|
34
|
+
const { articles, articleImages, timeZone = 'Europe/Madrid', readLabel = LABELS.articleCardGrid.readLabel, updatedLabel = LABELS.articleCardGrid.updatedLabel, routes } = Astro.props;
|
|
32
35
|
|
|
33
36
|
function formatCardDate(dateStr: string | undefined): string {
|
|
34
37
|
if (!dateStr) return '';
|
|
@@ -44,7 +47,7 @@ const items = articles.map(({ data: a }) => {
|
|
|
44
47
|
const updated = Boolean(a.dateModified && (!a.datePublished || a.dateModified.slice(0, 10) !== a.datePublished.slice(0, 10)));
|
|
45
48
|
const dateTime = (updated ? a.dateModified : a.datePublished) ?? '';
|
|
46
49
|
return {
|
|
47
|
-
href: url(
|
|
50
|
+
href: url(routePath('articles', a.slug, routes)),
|
|
48
51
|
title: a.title,
|
|
49
52
|
description: a.description,
|
|
50
53
|
author: a.author,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** HomeTripPlanner — the home page's "Build your trip" band: one card per plan page, the featured one outlined. */
|
|
3
3
|
import { Container } from '@sarimarcus/content-sites-ui/layout';
|
|
4
4
|
import { url } from '@sarimarcus/content-sites-core/url';
|
|
5
|
+
import { LABELS } from '../internal/labels';
|
|
5
6
|
|
|
6
7
|
export interface HomeTripPlannerCard {
|
|
7
8
|
title: string;
|
|
@@ -16,7 +17,7 @@ interface Props {
|
|
|
16
17
|
heading?: string;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
const { cards, eyebrow =
|
|
20
|
+
const { cards, eyebrow = LABELS.homeTripPlanner.eyebrow, heading = LABELS.homeTripPlanner.heading } = Astro.props;
|
|
20
21
|
---
|
|
21
22
|
|
|
22
23
|
<section class="bg-chalk-warm border-b border-border py-12 lg:py-16">
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* Each stop links to its neighborhood page.
|
|
6
6
|
*/
|
|
7
7
|
import { Badge, Icon } from '@sarimarcus/content-sites-ui/primitives';
|
|
8
|
-
import { url } from '@sarimarcus/content-sites-core/url';
|
|
8
|
+
import { routePath, url, type SiteRoutes } from '@sarimarcus/content-sites-core/url';
|
|
9
|
+
import { LABELS } from '../internal/labels';
|
|
9
10
|
|
|
10
11
|
export interface ItineraryTeaserStop {
|
|
11
12
|
neighborhood: string;
|
|
@@ -21,6 +22,8 @@ interface Props {
|
|
|
21
22
|
ctaText: string;
|
|
22
23
|
ctaUrl: string;
|
|
23
24
|
badgeLabel?: string;
|
|
25
|
+
/** Overrides of the `neighborhood` route. */
|
|
26
|
+
routes?: SiteRoutes;
|
|
24
27
|
class?: string;
|
|
25
28
|
}
|
|
26
29
|
|
|
@@ -30,7 +33,8 @@ const {
|
|
|
30
33
|
stops,
|
|
31
34
|
ctaText,
|
|
32
35
|
ctaUrl,
|
|
33
|
-
badgeLabel =
|
|
36
|
+
badgeLabel = LABELS.itineraryTeaser.badgeLabel,
|
|
37
|
+
routes,
|
|
34
38
|
class: className,
|
|
35
39
|
} = Astro.props;
|
|
36
40
|
const ctaHref = url(ctaUrl);
|
|
@@ -67,7 +71,7 @@ const ctaHref = url(ctaUrl);
|
|
|
67
71
|
</div>
|
|
68
72
|
|
|
69
73
|
<a
|
|
70
|
-
href={url(
|
|
74
|
+
href={url(routePath('neighborhood', stop.slug, routes))}
|
|
71
75
|
class="block mt-6 p-5 bg-overlay-foreground/5 hover:bg-overlay-foreground/10 border border-overlay-foreground/10 hover:border-overlay-foreground/20 rounded-xl transition-all duration-200 group"
|
|
72
76
|
>
|
|
73
77
|
<h3 class="text-lg font-display font-medium text-overlay-foreground mb-2 group-hover:text-accent transition-colors">
|
|
@@ -4,6 +4,7 @@ import { Callout } from '@sarimarcus/content-sites-ui/primitives';
|
|
|
4
4
|
import { ComparisonTable, DidYouKnow, Quote, StatFact, Timeline, VisitTiming } from '@sarimarcus/content-sites-ui/editorial';
|
|
5
5
|
import { trustedHtml } from '@sarimarcus/content-sites-ui/types';
|
|
6
6
|
import type { MonumentBodyLabels, MonumentBodySection, MonumentBodyTip, MonumentBodyVisitTiming } from './monumentBody.ts';
|
|
7
|
+
import { LABELS } from '../internal/labels';
|
|
7
8
|
|
|
8
9
|
interface Props {
|
|
9
10
|
index: number;
|
|
@@ -19,8 +20,8 @@ interface Props {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const { section, lede, visitTiming, interludes, tip, renderMarkdown, renderInline, tagLinks, labels } = Astro.props;
|
|
22
|
-
const didYouKnowLabel = labels?.didYouKnow ??
|
|
23
|
-
const timelineLabel = labels?.timeline ??
|
|
23
|
+
const didYouKnowLabel = labels?.didYouKnow ?? LABELS.monumentBodySlot.didYouKnow;
|
|
24
|
+
const timelineLabel = labels?.timeline ?? LABELS.monumentBodySlot.timeline;
|
|
24
25
|
const pathname = Astro.url.pathname;
|
|
25
26
|
const md = (s: string | undefined) => trustedHtml(typeof s === 'string' ? renderInline(s) : '');
|
|
26
27
|
const tag = (html: string) => (tagLinks ? tagLinks(html, pathname) : html);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { ImageMetadata } from 'astro';
|
|
8
8
|
import { Icon, ResponsivePicture } from '@sarimarcus/content-sites-ui/primitives';
|
|
9
|
+
import { LABELS } from '../internal/labels';
|
|
9
10
|
|
|
10
11
|
interface Props {
|
|
11
12
|
rank: number;
|
|
@@ -39,12 +40,12 @@ const {
|
|
|
39
40
|
distanceText,
|
|
40
41
|
walkLabel,
|
|
41
42
|
rating,
|
|
42
|
-
ratingSuffix =
|
|
43
|
+
ratingSuffix = LABELS.rankedListingRow.ratingSuffix,
|
|
43
44
|
meta,
|
|
44
45
|
priceLine,
|
|
45
46
|
specialties = [],
|
|
46
47
|
description,
|
|
47
|
-
ctaLabel =
|
|
48
|
+
ctaLabel = LABELS.rankedListingRow.ctaLabel,
|
|
48
49
|
} = Astro.props;
|
|
49
50
|
|
|
50
51
|
const paddedRank = String(rank).padStart(2, '0');
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Badge, Icon } from '@sarimarcus/content-sites-ui/primitives';
|
|
7
7
|
import { url } from '@sarimarcus/content-sites-core/url';
|
|
8
|
+
import { LABELS } from '../internal/labels';
|
|
8
9
|
|
|
9
10
|
export interface WalkStop {
|
|
10
11
|
order: number;
|
|
@@ -22,25 +23,22 @@ interface Props {
|
|
|
22
23
|
heading?: string;
|
|
23
24
|
/** Prefix before a stop's tip. */
|
|
24
25
|
tipLabel?: string;
|
|
26
|
+
/** Stop type → label; default English. */
|
|
27
|
+
typeLabels?: Record<string, string>;
|
|
25
28
|
class?: string;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
const {
|
|
31
|
+
const {
|
|
32
|
+
stops,
|
|
33
|
+
heading = LABELS.walkStops.heading,
|
|
34
|
+
tipLabel = LABELS.walkStops.tipLabel,
|
|
35
|
+
typeLabels = LABELS.walkStops.typeLabels as Record<string, string>,
|
|
36
|
+
class: className,
|
|
37
|
+
} = Astro.props;
|
|
29
38
|
|
|
30
39
|
// Stop types with an entity page at /<type>/<slug>.
|
|
31
40
|
const ROUTED = new Set(['monument', 'museum', 'restaurant', 'bar', 'neighborhood', 'activity', 'dish', 'event']);
|
|
32
41
|
|
|
33
|
-
const typeLabels: Record<string, string> = {
|
|
34
|
-
monument: 'Monument',
|
|
35
|
-
museum: 'Museum',
|
|
36
|
-
restaurant: 'Restaurant',
|
|
37
|
-
bar: 'Bar',
|
|
38
|
-
neighborhood: 'Neighborhood',
|
|
39
|
-
activity: 'Activity',
|
|
40
|
-
dish: 'Dish',
|
|
41
|
-
event: 'Event',
|
|
42
|
-
landmark: 'Landmark',
|
|
43
|
-
};
|
|
44
42
|
|
|
45
43
|
const stopHref = (stop: WalkStop) => (ROUTED.has(stop.type) && stop.slug ? url(`/${stop.type}/${stop.slug}`) : undefined);
|
|
46
44
|
---
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { LinkArrow } from '@sarimarcus/content-sites-ui/primitives';
|
|
8
8
|
import { url } from '@sarimarcus/content-sites-core/url';
|
|
9
|
+
import { LABELS } from '../internal/labels';
|
|
9
10
|
|
|
10
11
|
export interface WhoItsForTag {
|
|
11
12
|
field: 'audiences' | 'themes';
|
|
@@ -21,7 +22,7 @@ interface Props {
|
|
|
21
22
|
class?: string;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
const { tags, label =
|
|
25
|
+
const { tags, label = LABELS.whoItsFor.label, ariaLabel = LABELS.whoItsFor.ariaLabel, class: className = '' } = Astro.props;
|
|
25
26
|
|
|
26
27
|
const links = tags.map((tag) => ({
|
|
27
28
|
label: tag.label,
|
package/src/types/index.ts
DELETED