@sarimarcus/content-sites-tourism 0.36.0 → 0.38.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/package.json +4 -3
- package/src/llms/index.ts +3 -0
- package/src/llms/tourismLlms.ts +183 -0
- package/src/sections/ArticleCardGrid.astro +2 -2
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.38.0 (2026-10-15)
|
|
6
|
+
|
|
7
|
+
- `ArticleCardGrid` takes its "Updated" test from core `isUpdatedAfterPublication`; output unchanged (SLA-3120).
|
|
8
|
+
|
|
9
|
+
## 0.37.0 (2026-10-14)
|
|
10
|
+
|
|
11
|
+
- `llms`: new export with `tourismLlmsTxt(input)`, the llms.txt both tourism sites kept as a hand-written `public/llms.txt`. Summary counts, per-neighborhood counts, item lists and the AI Agents block (from the site's `webmcp-tools.json` snapshot) are derived from the collections; hand-written sections come in as data (SLA-3083).
|
|
12
|
+
|
|
5
13
|
## 0.36.0 (2026-10-14)
|
|
6
14
|
|
|
7
15
|
- No changes; lockstep release with ui (SLA-3084).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-tourism",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.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,12 +30,13 @@
|
|
|
30
30
|
"./sections": "./src/sections/index.ts",
|
|
31
31
|
"./templates": "./src/templates/index.ts",
|
|
32
32
|
"./schema": "./src/schema/index.ts",
|
|
33
|
+
"./llms": "./src/llms/index.ts",
|
|
33
34
|
"./tailwind.css": "./src/tailwind.css"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
36
37
|
"astro": "^7.0.6",
|
|
37
38
|
"tailwindcss": "^4.1.18",
|
|
38
|
-
"@sarimarcus/content-sites-core": "0.
|
|
39
|
-
"@sarimarcus/content-sites-ui": "0.
|
|
39
|
+
"@sarimarcus/content-sites-core": "0.38.0",
|
|
40
|
+
"@sarimarcus/content-sites-ui": "0.38.0"
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { renderLlmsTxt } from '@sarimarcus/content-sites-core/llms';
|
|
2
|
+
import type { LlmsLink, LlmsSection } from '@sarimarcus/content-sites-core/llms';
|
|
3
|
+
|
|
4
|
+
export interface TourismLlmsItem {
|
|
5
|
+
slug: string;
|
|
6
|
+
name?: string | null;
|
|
7
|
+
title?: string | null;
|
|
8
|
+
description?: string | null;
|
|
9
|
+
neighborhood?: string | null;
|
|
10
|
+
datePublished?: string | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TourismLlmsCollections {
|
|
14
|
+
neighborhoods: TourismLlmsItem[];
|
|
15
|
+
monuments: TourismLlmsItem[];
|
|
16
|
+
museums: TourismLlmsItem[];
|
|
17
|
+
walks: TourismLlmsItem[];
|
|
18
|
+
events: TourismLlmsItem[];
|
|
19
|
+
activities: TourismLlmsItem[];
|
|
20
|
+
restaurants: TourismLlmsItem[];
|
|
21
|
+
hotels: TourismLlmsItem[];
|
|
22
|
+
dishes: TourismLlmsItem[];
|
|
23
|
+
bars: TourismLlmsItem[];
|
|
24
|
+
guides: TourismLlmsItem[];
|
|
25
|
+
articles: TourismLlmsItem[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface TourismLlmsInput {
|
|
29
|
+
siteName: string;
|
|
30
|
+
siteUrl: string;
|
|
31
|
+
lead: string;
|
|
32
|
+
preamble: string;
|
|
33
|
+
collections: TourismLlmsCollections;
|
|
34
|
+
/** Intro paragraph per generated section; `{n}` becomes the section's item count. */
|
|
35
|
+
intros?: Record<string, string>;
|
|
36
|
+
/** Hand-written links kept inside a generated section. */
|
|
37
|
+
extraLinks?: Record<string, LlmsLink[]>;
|
|
38
|
+
staticSections?: LlmsSection[];
|
|
39
|
+
closingSections?: LlmsSection[];
|
|
40
|
+
tools: { name: string; description: string }[];
|
|
41
|
+
/** Article slugs listed first, in this order; slugs that no longer exist are skipped. */
|
|
42
|
+
featuredArticles?: string[];
|
|
43
|
+
maxArticles?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface Spec {
|
|
47
|
+
key: keyof TourismLlmsCollections;
|
|
48
|
+
heading: string;
|
|
49
|
+
route: string;
|
|
50
|
+
hub?: LlmsLink;
|
|
51
|
+
/** Trim length for long directories, so one section cannot dominate the file. */
|
|
52
|
+
maxDescription?: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const SPECS: Spec[] = [
|
|
56
|
+
{ key: 'neighborhoods', maxDescription: 400, heading: 'Neighborhoods', route: 'neighborhood', hub: { title: 'All neighborhoods', path: '/neighborhoods' } },
|
|
57
|
+
{ key: 'monuments', heading: 'Monuments & Attractions', route: 'monument', hub: { title: 'All monuments', path: '/monuments' } },
|
|
58
|
+
{ key: 'museums', heading: 'Museums', route: 'museum', hub: { title: 'All museums', path: '/museums' } },
|
|
59
|
+
{ key: 'walks', heading: 'Self-Guided Walks', route: 'walk', hub: { title: 'All walks', path: '/walks' } },
|
|
60
|
+
{ key: 'events', heading: 'Festivals & Events', route: 'event', hub: { title: 'All events', path: '/events' } },
|
|
61
|
+
{ key: 'activities', heading: 'Activities & Experiences', route: 'activity', hub: { title: 'All activities', path: '/activities' } },
|
|
62
|
+
{ key: 'restaurants', maxDescription: 100, heading: 'Restaurants', route: 'restaurant', hub: { title: 'All restaurants', path: '/restaurants' } },
|
|
63
|
+
{ key: 'hotels', maxDescription: 100, heading: 'Hotels', route: 'hotel', hub: { title: 'All hotels', path: '/hotels' } },
|
|
64
|
+
{ key: 'dishes', heading: 'Local Food & Drinks', route: 'dish', hub: { title: 'All dishes', path: '/dishes' } },
|
|
65
|
+
{ key: 'bars', maxDescription: 100, heading: 'Bars & Nightlife', route: 'bar', hub: { title: 'All bars', path: '/bars' } },
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const SUMMARY_LABELS: [keyof TourismLlmsCollections, string, string][] = [
|
|
69
|
+
['monuments', 'monument', 'monuments'],
|
|
70
|
+
['museums', 'museum', 'museums'],
|
|
71
|
+
['neighborhoods', 'neighborhood', 'neighborhoods'],
|
|
72
|
+
['activities', 'activity', 'activities'],
|
|
73
|
+
['events', 'event', 'events'],
|
|
74
|
+
['dishes', 'signature dish', 'signature dishes'],
|
|
75
|
+
['restaurants', 'restaurant', 'restaurants'],
|
|
76
|
+
['hotels', 'hotel', 'hotels'],
|
|
77
|
+
['bars', 'bar', 'bars'],
|
|
78
|
+
['walks', 'self-guided walk', 'self-guided walks'],
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
const byName = (a: TourismLlmsItem, b: TourismLlmsItem) =>
|
|
82
|
+
(a.name ?? a.title ?? a.slug).localeCompare(b.name ?? b.title ?? b.slug);
|
|
83
|
+
|
|
84
|
+
const plural = (n: number, one: string, many: string) => `${n} ${n === 1 ? one : many}`;
|
|
85
|
+
|
|
86
|
+
const andList = (parts: string[]) =>
|
|
87
|
+
parts.length < 3
|
|
88
|
+
? parts.join(' and ')
|
|
89
|
+
: `${parts.slice(0, -1).join(', ')}, and ${parts[parts.length - 1]}`;
|
|
90
|
+
|
|
91
|
+
const LABELS = new Map(SUMMARY_LABELS.map(([key, one, many]) => [key, { one, many }]));
|
|
92
|
+
const NEIGHBORHOOD_COUNTED = ['monuments', 'hotels', 'restaurants'] as const;
|
|
93
|
+
|
|
94
|
+
function neighborhoodDescription(item: TourismLlmsItem, c: TourismLlmsCollections): string | undefined {
|
|
95
|
+
const counts = NEIGHBORHOOD_COUNTED.map((key) => [c[key].filter((i) => i.neighborhood === item.slug).length, LABELS.get(key)!] as const)
|
|
96
|
+
.filter(([n]) => n > 0)
|
|
97
|
+
.map(([n, label]) => plural(n, label.one, label.many));
|
|
98
|
+
const tail = counts.length ? ` Has ${andList(counts)}.` : '';
|
|
99
|
+
return item.description ? `${item.description}${tail}` : tail.trim() || undefined;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function pickArticles(articles: TourismLlmsItem[], featured: string[], max: number): TourismLlmsItem[] {
|
|
103
|
+
const bySlug = new Map(articles.map((a) => [a.slug, a]));
|
|
104
|
+
const first = featured.flatMap((slug) => bySlug.get(slug) ?? []);
|
|
105
|
+
const rest = articles
|
|
106
|
+
.filter((a) => !featured.includes(a.slug))
|
|
107
|
+
.sort((a, b) => (b.datePublished ?? '').localeCompare(a.datePublished ?? ''));
|
|
108
|
+
return [...first, ...rest].slice(0, Math.max(max, first.length));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function aiAgentsBlock(siteUrl: string, tools: TourismLlmsInput['tools']): string {
|
|
112
|
+
const host = new URL(siteUrl).host.replace(/^www\./, '');
|
|
113
|
+
const base = `https://agents.${host}`;
|
|
114
|
+
const intro = `This site runs a read-only MCP server for AI agents at ${base}/ (endpoint: ${base}/mcp, discovery document: ${base}/.well-known/mcp/server.json).`;
|
|
115
|
+
const list = tools.length
|
|
116
|
+
? ` It has ${plural(tools.length, 'tool', 'tools')}: ${tools
|
|
117
|
+
.map((t) => {
|
|
118
|
+
const gist = t.description.split(/(?<=\.)\s/)[0].replace(/\.$/, '');
|
|
119
|
+
return gist ? `${t.name} (${gist})` : t.name;
|
|
120
|
+
})
|
|
121
|
+
.join(', ')}.`
|
|
122
|
+
: ' No tools are live yet.';
|
|
123
|
+
return `${intro}${list} See ${siteUrl}/agents for connection details and current status before assuming otherwise.`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** The full llms.txt for a tourism site: counts and item lists come from the collections, never from copy. */
|
|
127
|
+
export function tourismLlmsTxt(input: TourismLlmsInput): string {
|
|
128
|
+
const { collections: c, intros = {}, extraLinks = {} } = input;
|
|
129
|
+
const siteUrl = input.siteUrl.replace(/\/$/, '');
|
|
130
|
+
|
|
131
|
+
const counted = SUMMARY_LABELS.filter(([key]) => c[key].length > 0).map(([key, one, many]) =>
|
|
132
|
+
plural(c[key].length, one, many),
|
|
133
|
+
);
|
|
134
|
+
const guideCount = c.guides.length + c.articles.length;
|
|
135
|
+
const covers = counted.length ? ` The site covers ${andList(counted)}` : '';
|
|
136
|
+
const plus = guideCount ? `${covers ? ', plus' : ' The site has'} ${plural(guideCount, 'guide or article', 'guides and articles')} for planning a trip` : '';
|
|
137
|
+
const summary = `${input.lead}${covers}${plus}${covers || plus ? '.' : ''}`;
|
|
138
|
+
|
|
139
|
+
const generated: LlmsSection[] = SPECS.filter((spec) => c[spec.key].length > 0).map((spec) => {
|
|
140
|
+
const items = [...c[spec.key]].sort(byName);
|
|
141
|
+
const links: LlmsLink[] = items.map((item) => ({
|
|
142
|
+
title: item.name ?? item.title ?? item.slug,
|
|
143
|
+
path: `/${spec.route}/${item.slug}`,
|
|
144
|
+
description: spec.key === 'neighborhoods' ? neighborhoodDescription(item, c) : item.description,
|
|
145
|
+
...(spec.maxDescription ? { maxDescription: spec.maxDescription } : {}),
|
|
146
|
+
}));
|
|
147
|
+
return {
|
|
148
|
+
heading: spec.heading,
|
|
149
|
+
intro: intros[spec.key]?.replace('{n}', String(items.length)),
|
|
150
|
+
links: [...links, ...(extraLinks[spec.key] ?? []), ...(spec.hub ? [{ ...spec.hub, title: `${spec.hub.title} (${items.length})` }] : [])],
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const guides: LlmsSection = {
|
|
155
|
+
heading: 'Ranked Guides',
|
|
156
|
+
links: [
|
|
157
|
+
...[...c.guides].sort(byName).map((g) => ({ title: g.title ?? g.slug, path: `/guides/${g.slug}`, description: g.description })),
|
|
158
|
+
{ title: 'All guides', path: '/guides' },
|
|
159
|
+
],
|
|
160
|
+
};
|
|
161
|
+
const articles: LlmsSection = {
|
|
162
|
+
heading: 'Longform Articles',
|
|
163
|
+
links: [
|
|
164
|
+
...pickArticles(c.articles, input.featuredArticles ?? [], input.maxArticles ?? 15)
|
|
165
|
+
.map((a) => ({ title: a.title ?? a.slug, path: `/articles/${a.slug}`, description: a.description })),
|
|
166
|
+
{ title: `All articles (${c.articles.length})`, path: '/articles' },
|
|
167
|
+
],
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return renderLlmsTxt(siteUrl, {
|
|
171
|
+
title: input.siteName,
|
|
172
|
+
summary,
|
|
173
|
+
preamble: input.preamble,
|
|
174
|
+
sections: [
|
|
175
|
+
...generated,
|
|
176
|
+
...(input.staticSections ?? []),
|
|
177
|
+
guides,
|
|
178
|
+
articles,
|
|
179
|
+
...(input.closingSections ?? []),
|
|
180
|
+
{ heading: 'AI Agents', prose: aiAgentsBlock(siteUrl, input.tools) },
|
|
181
|
+
],
|
|
182
|
+
});
|
|
183
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { ImageMetadata } from 'astro';
|
|
7
7
|
import { ArticleGrid } from '@sarimarcus/content-sites-ui/editorial';
|
|
8
|
+
import { isUpdatedAfterPublication } from '@sarimarcus/content-sites-core/articles';
|
|
8
9
|
import { routePath, url, type SiteRoutes } from '@sarimarcus/content-sites-core/url';
|
|
9
10
|
import { LABELS } from '../internal/labels';
|
|
10
11
|
|
|
@@ -43,8 +44,7 @@ function formatCardDate(dateStr: string | undefined): string {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
const items = articles.map(({ data: a }) => {
|
|
46
|
-
|
|
47
|
-
const updated = Boolean(a.dateModified && (!a.datePublished || a.dateModified.slice(0, 10) !== a.datePublished.slice(0, 10)));
|
|
47
|
+
const updated = isUpdatedAfterPublication(a);
|
|
48
48
|
const dateTime = (updated ? a.dateModified : a.datePublished) ?? '';
|
|
49
49
|
return {
|
|
50
50
|
href: url(routePath('articles', a.slug, routes)),
|