@se-studio/core-ui 1.50.0 → 1.56.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 +61 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/route-handlers/createScreenshotHandler.d.ts +10 -0
- package/dist/route-handlers/createScreenshotHandler.d.ts.map +1 -0
- package/dist/route-handlers/createScreenshotHandler.js +34 -0
- package/dist/route-handlers/createScreenshotHandler.js.map +1 -0
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/site-files/CmsDevAnalyticsProvider.d.ts +4 -0
- package/dist/site-files/CmsDevAnalyticsProvider.d.ts.map +1 -0
- package/dist/site-files/CmsDevAnalyticsProvider.js +11 -0
- package/dist/site-files/CmsDevAnalyticsProvider.js.map +1 -0
- package/dist/site-files/VideoTestScenario.d.ts +5 -0
- package/dist/site-files/VideoTestScenario.d.ts.map +1 -0
- package/dist/site-files/VideoTestScenario.js +49 -0
- package/dist/site-files/VideoTestScenario.js.map +1 -0
- package/dist/site-files/client.d.ts +3 -0
- package/dist/site-files/client.d.ts.map +1 -0
- package/dist/site-files/client.js +3 -0
- package/dist/site-files/client.js.map +1 -0
- package/dist/site-files/cmsDev.d.ts +35 -0
- package/dist/site-files/cmsDev.d.ts.map +1 -0
- package/dist/site-files/cmsDev.js +182 -0
- package/dist/site-files/cmsDev.js.map +1 -0
- package/dist/site-files/config.d.ts +227 -0
- package/dist/site-files/config.d.ts.map +1 -0
- package/dist/site-files/config.js +11 -0
- package/dist/site-files/config.js.map +1 -0
- package/dist/site-files/index.d.ts +8 -0
- package/dist/site-files/index.d.ts.map +1 -0
- package/dist/site-files/index.js +7 -0
- package/dist/site-files/index.js.map +1 -0
- package/dist/site-files/markdown.d.ts +14 -0
- package/dist/site-files/markdown.d.ts.map +1 -0
- package/dist/site-files/markdown.js +153 -0
- package/dist/site-files/markdown.js.map +1 -0
- package/dist/site-files/root.d.ts +23 -0
- package/dist/site-files/root.d.ts.map +1 -0
- package/dist/site-files/root.js +50 -0
- package/dist/site-files/root.js.map +1 -0
- package/dist/site-files/routes.d.ts +20 -0
- package/dist/site-files/routes.d.ts.map +1 -0
- package/dist/site-files/routes.js +144 -0
- package/dist/site-files/routes.js.map +1 -0
- package/dist/site-files/testVideos.d.ts +9 -0
- package/dist/site-files/testVideos.d.ts.map +1 -0
- package/dist/site-files/testVideos.js +75 -0
- package/dist/site-files/testVideos.js.map +1 -0
- package/dist/utils/isProductionDeployment.d.ts +20 -0
- package/dist/utils/isProductionDeployment.d.ts.map +1 -0
- package/dist/utils/isProductionDeployment.js +14 -0
- package/dist/utils/isProductionDeployment.js.map +1 -0
- package/dist/utils/robots.d.ts +23 -1
- package/dist/utils/robots.d.ts.map +1 -1
- package/dist/utils/robots.js +38 -1
- package/dist/utils/robots.js.map +1 -1
- package/dist/utils/sitemap.d.ts +42 -0
- package/dist/utils/sitemap.d.ts.map +1 -1
- package/dist/utils/sitemap.js +74 -3
- package/dist/utils/sitemap.js.map +1 -1
- package/dist/well-known/generated.d.ts +1 -1
- package/dist/well-known/generated.js +1 -1
- package/docs/SITE_FILES.md +146 -0
- package/docs/llms.md +7 -0
- package/package.json +11 -2
package/dist/utils/robots.js
CHANGED
|
@@ -190,6 +190,23 @@ function appendDisallowLines(lines, paths) {
|
|
|
190
190
|
lines.push(`Disallow: ${path}`);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
+
function resolveBlockedUserAgents(options) {
|
|
194
|
+
const blocked = options.blockedUserAgents ?? [];
|
|
195
|
+
for (const userAgent of blocked) {
|
|
196
|
+
if (!userAgent.trim() || /[\r\n]/.test(userAgent)) {
|
|
197
|
+
throw new Error('robots.txt blockedUserAgents entries must be non-empty single-line tokens');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (options.blockedUserAgentsEnvironments === 'production' && !options.isProduction) {
|
|
201
|
+
return [];
|
|
202
|
+
}
|
|
203
|
+
return blocked;
|
|
204
|
+
}
|
|
205
|
+
function appendBlockedGroups(lines, blocked) {
|
|
206
|
+
for (const userAgent of blocked) {
|
|
207
|
+
lines.push(`User-agent: ${userAgent}`, 'Disallow: /', '');
|
|
208
|
+
}
|
|
209
|
+
}
|
|
193
210
|
/**
|
|
194
211
|
* Builds a full plain-text robots.txt body, including optional Content-Signal,
|
|
195
212
|
* preamble comments, and additional user-agent groups.
|
|
@@ -203,17 +220,32 @@ function appendDisallowLines(lines, paths) {
|
|
|
203
220
|
*/
|
|
204
221
|
export function formatRobotsTxt(options) {
|
|
205
222
|
const sitemap = options.sitemapUrl ?? `${options.baseUrl}/sitemap.xml`;
|
|
223
|
+
const blocked = resolveBlockedUserAgents(options);
|
|
224
|
+
const blockedAtTop = blocked.length > 0 && options.blockedUserAgentsPosition === 'top';
|
|
225
|
+
const blockedBeforeSitemap = blocked.length > 0 && !blockedAtTop;
|
|
206
226
|
if (!options.isProduction) {
|
|
207
|
-
const lines = [
|
|
227
|
+
const lines = [];
|
|
228
|
+
if (blockedAtTop) {
|
|
229
|
+
appendBlockedGroups(lines, blocked);
|
|
230
|
+
}
|
|
231
|
+
lines.push('User-agent: *', 'Disallow: /');
|
|
208
232
|
if (options.stagingAllowRules?.length) {
|
|
209
233
|
for (const rule of options.stagingAllowRules) {
|
|
210
234
|
lines.push('', `User-agent: ${rule.userAgent}`, `Allow: ${rule.allow}`);
|
|
211
235
|
}
|
|
212
236
|
}
|
|
237
|
+
if (blockedBeforeSitemap) {
|
|
238
|
+
lines.push('');
|
|
239
|
+
appendBlockedGroups(lines, blocked);
|
|
240
|
+
lines.pop();
|
|
241
|
+
}
|
|
213
242
|
lines.push('', `Sitemap: ${sitemap}`, '');
|
|
214
243
|
return lines.join('\n');
|
|
215
244
|
}
|
|
216
245
|
const lines = [];
|
|
246
|
+
if (blockedAtTop) {
|
|
247
|
+
appendBlockedGroups(lines, blocked);
|
|
248
|
+
}
|
|
217
249
|
if (options.preamble !== undefined) {
|
|
218
250
|
lines.push(...formatPreambleLines(options.preamble));
|
|
219
251
|
lines.push('');
|
|
@@ -243,6 +275,11 @@ export function formatRobotsTxt(options) {
|
|
|
243
275
|
appendDisallowLines(lines, groupDisallow);
|
|
244
276
|
}
|
|
245
277
|
}
|
|
278
|
+
if (blockedBeforeSitemap) {
|
|
279
|
+
lines.push('');
|
|
280
|
+
appendBlockedGroups(lines, blocked);
|
|
281
|
+
lines.pop();
|
|
282
|
+
}
|
|
246
283
|
lines.push('', `Sitemap: ${sitemap}`, '');
|
|
247
284
|
return lines.join('\n');
|
|
248
285
|
}
|
package/dist/utils/robots.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"robots.js","sourceRoot":"","sources":["../../src/utils/robots.ts"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,WAAW;IACX,cAAc;IACd,OAAO;IACP,WAAW;IACX,aAAa;IACb,OAAO;IACP,MAAM;CACE,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,UAAU,CAAU,CAAC;AAE/F;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW;IACX,aAAa;IACb,kBAAkB;IAClB,QAAQ;IACR,cAAc;IACd,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,oBAAoB;IACpB,sBAAsB;IACtB,iBAAiB;IACjB,WAAW;IACX,gBAAgB;IAChB,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,OAAO;IACP,YAAY;IACZ,SAAS;IACT,WAAW;CACH,CAAC;
|
|
1
|
+
{"version":3,"file":"robots.js","sourceRoot":"","sources":["../../src/utils/robots.ts"],"names":[],"mappings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;gBAC/C,CAAC,CAAC,CAAC,GAAG,cAAc,EAAE,GAAG,KAAK,CAAC,aAAa,CAAC;gBAC7C,CAAC,CAAC,cAAc,CAAC;YACnB,mBAAmB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,IAAI,oBAAoB,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACpC,KAAK,CAAC,GAAG,EAAE,CAAC;IACd,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,YAAY,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAA+B;IACrE,OAAO,IAAI,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE;QAC5C,OAAO,EAAE,EAAE,cAAc,EAAE,2BAA2B,EAAE;KACzD,CAAC,CAAC;AACL,CAAC"}
|
package/dist/utils/sitemap.d.ts
CHANGED
|
@@ -124,9 +124,26 @@ export declare const SITEMAP_CACHE_TAG = "sitemap";
|
|
|
124
124
|
* Skip the Vercel CDN; listing Data Cache stays `force-cache` + {@link SITEMAP_CACHE_TAG}.
|
|
125
125
|
*/
|
|
126
126
|
export declare const SITEMAP_XML_HEADERS: Record<string, string>;
|
|
127
|
+
/**
|
|
128
|
+
* Options for {@link createSitemapXmlRouteHandler}.
|
|
129
|
+
*
|
|
130
|
+
* `excludeEntry`: return true to drop an entry (for example a page type that is not routed on the site);
|
|
131
|
+
* runs on the entries as returned by `getEntries`, before de-duplication.
|
|
132
|
+
*
|
|
133
|
+
* `applySlugGuard`: drop entries whose path `pathnameHasImpossibleCmsSlug` rejects, so the sitemap never
|
|
134
|
+
* lists a URL the CMS page handlers would 404 (parity with the site-check slug guard). Off by default.
|
|
135
|
+
*
|
|
136
|
+
* `onError`: called with the thrown value when `getEntries` fails, before the 503 is returned. Default
|
|
137
|
+
* `console.error`, so the failure is visible in logs.
|
|
138
|
+
*/
|
|
127
139
|
export interface CreateSitemapXmlRouteHandlerOptions extends GenerateSitemapOptions {
|
|
128
140
|
getEntries: () => Promise<SitemapEntry[]>;
|
|
141
|
+
excludeEntry?: (entry: SitemapEntry) => boolean;
|
|
142
|
+
applySlugGuard?: boolean;
|
|
143
|
+
onError?: (error: unknown) => void;
|
|
129
144
|
}
|
|
145
|
+
/** Response headers for a failed sitemap build: never cached, so a crawler retries. */
|
|
146
|
+
export declare const SITEMAP_ERROR_HEADERS: Record<string, string>;
|
|
130
147
|
/**
|
|
131
148
|
* Returns a `application/xml` Response with CDN no-store headers.
|
|
132
149
|
* Use from `app/sitemap.xml/route.ts` (and unindexed).
|
|
@@ -143,4 +160,29 @@ export declare function createSitemapXmlResponse(xml: string): Response;
|
|
|
143
160
|
* ```
|
|
144
161
|
*/
|
|
145
162
|
export declare function createSitemapXmlRouteHandler(options: CreateSitemapXmlRouteHandlerOptions): () => Promise<Response>;
|
|
163
|
+
/** One child sitemap in a sitemap index: `url` is absolute, or a path resolved against `baseUrl`. */
|
|
164
|
+
export interface SitemapIndexItem {
|
|
165
|
+
url: string;
|
|
166
|
+
lastModified?: Date | string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Options for {@link createSitemapIndexRouteHandler}. `sitemaps` is the child list, or a function that
|
|
170
|
+
* returns it (for example from the CMS). `defaultLastModified` applies to items without their own
|
|
171
|
+
* `lastmod` and defaults to the time of the request.
|
|
172
|
+
*/
|
|
173
|
+
export interface CreateSitemapIndexRouteHandlerOptions {
|
|
174
|
+
baseUrl: string;
|
|
175
|
+
sitemaps: readonly SitemapIndexItem[] | (() => Promise<readonly SitemapIndexItem[]>);
|
|
176
|
+
defaultLastModified?: Date | string;
|
|
177
|
+
onError?: (error: unknown) => void;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Serialises a `<sitemapindex>` (not a `<urlset>`). Child URLs that are paths are resolved against `baseUrl`.
|
|
181
|
+
*/
|
|
182
|
+
export declare function sitemapIndexToXml(items: readonly SitemapIndexItem[], baseUrl: string, defaultLastModified?: Date | string): string;
|
|
183
|
+
/**
|
|
184
|
+
* GET handler for a sitemap index route (`app/sitemap.xml/route.ts` on a site that splits its sitemap).
|
|
185
|
+
* Same headers and the same 503-on-error rule as {@link createSitemapXmlRouteHandler}.
|
|
186
|
+
*/
|
|
187
|
+
export declare function createSitemapIndexRouteHandler(options: CreateSitemapIndexRouteHandlerOptions): () => Promise<Response>;
|
|
146
188
|
//# sourceMappingURL=sitemap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../../src/utils/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../../src/utils/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAG1C;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,OAAO,CAAC;AAEZ;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CACpD;AAED;;GAEG;AACH,M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startsWith('http://') || url.startsWith('https://')) {
|
|
3
4
|
return url;
|
|
@@ -210,6 +211,25 @@ export const SITEMAP_XML_HEADERS = {
|
|
|
210
211
|
'CDN-Cache-Control': 'private, no-store',
|
|
211
212
|
'Vercel-CDN-Cache-Control': 'private, no-store',
|
|
212
213
|
};
|
|
214
|
+
/** Response headers for a failed sitemap build: never cached, so a crawler retries. */
|
|
215
|
+
export const SITEMAP_ERROR_HEADERS = {
|
|
216
|
+
'Content-Type': 'text/plain; charset=utf-8',
|
|
217
|
+
'Cache-Control': 'private, no-store, no-cache, max-age=0, must-revalidate',
|
|
218
|
+
'CDN-Cache-Control': 'private, no-store',
|
|
219
|
+
'Vercel-CDN-Cache-Control': 'private, no-store',
|
|
220
|
+
'Retry-After': '300',
|
|
221
|
+
};
|
|
222
|
+
function entryPathname(url) {
|
|
223
|
+
if (url.startsWith('http://') || url.startsWith('https://')) {
|
|
224
|
+
try {
|
|
225
|
+
return new URL(url).pathname;
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
return url;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return url.startsWith('/') ? url : `/${url}`;
|
|
232
|
+
}
|
|
213
233
|
/**
|
|
214
234
|
* Returns a `application/xml` Response with CDN no-store headers.
|
|
215
235
|
* Use from `app/sitemap.xml/route.ts` (and unindexed).
|
|
@@ -228,10 +248,61 @@ export function createSitemapXmlResponse(xml) {
|
|
|
228
248
|
* ```
|
|
229
249
|
*/
|
|
230
250
|
export function createSitemapXmlRouteHandler(options) {
|
|
231
|
-
const { getEntries, ...sitemapOptions } = options;
|
|
251
|
+
const { getEntries, excludeEntry, applySlugGuard, onError, ...sitemapOptions } = options;
|
|
252
|
+
const keep = (entry) => !(excludeEntry?.(entry) ?? false) &&
|
|
253
|
+
!(applySlugGuard && pathnameHasImpossibleCmsSlug(entryPathname(entry.url)));
|
|
232
254
|
return async () => {
|
|
233
|
-
|
|
234
|
-
|
|
255
|
+
try {
|
|
256
|
+
const entries = await buildSitemap([async () => (await getEntries()).filter(keep)], sitemapOptions);
|
|
257
|
+
return createSitemapXmlResponse(sitemapToXml(entries));
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
(onError ?? logSitemapError)(error);
|
|
261
|
+
return new Response('Sitemap generation failed', {
|
|
262
|
+
status: 503,
|
|
263
|
+
headers: SITEMAP_ERROR_HEADERS,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function logSitemapError(error) {
|
|
269
|
+
console.error('[sitemap] generation failed', error);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Serialises a `<sitemapindex>` (not a `<urlset>`). Child URLs that are paths are resolved against `baseUrl`.
|
|
273
|
+
*/
|
|
274
|
+
export function sitemapIndexToXml(items, baseUrl, defaultLastModified = new Date()) {
|
|
275
|
+
const base = baseUrl.replace(/\/$/, '');
|
|
276
|
+
const entries = items
|
|
277
|
+
.map((item) => {
|
|
278
|
+
const loc = /^https?:\/\//.test(item.url)
|
|
279
|
+
? item.url
|
|
280
|
+
: `${base}${item.url.startsWith('/') ? item.url : `/${item.url}`}`;
|
|
281
|
+
const modified = item.lastModified ?? defaultLastModified;
|
|
282
|
+
const lastmod = typeof modified === 'string' ? modified : modified.toISOString();
|
|
283
|
+
return `<sitemap><loc>${escapeXml(loc)}</loc><lastmod>${escapeXml(lastmod)}</lastmod></sitemap>`;
|
|
284
|
+
})
|
|
285
|
+
.join('');
|
|
286
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
287
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${entries}</sitemapindex>`;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* GET handler for a sitemap index route (`app/sitemap.xml/route.ts` on a site that splits its sitemap).
|
|
291
|
+
* Same headers and the same 503-on-error rule as {@link createSitemapXmlRouteHandler}.
|
|
292
|
+
*/
|
|
293
|
+
export function createSitemapIndexRouteHandler(options) {
|
|
294
|
+
return async () => {
|
|
295
|
+
try {
|
|
296
|
+
const items = typeof options.sitemaps === 'function' ? await options.sitemaps() : options.sitemaps;
|
|
297
|
+
return createSitemapXmlResponse(sitemapIndexToXml(items, options.baseUrl, options.defaultLastModified));
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
(options.onError ?? logSitemapError)(error);
|
|
301
|
+
return new Response('Sitemap generation failed', {
|
|
302
|
+
status: 503,
|
|
303
|
+
headers: SITEMAP_ERROR_HEADERS,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
235
306
|
};
|
|
236
307
|
}
|
|
237
308
|
//# sourceMappingURL=sitemap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sitemap.js","sourceRoot":"","sources":["../../src/utils/sitemap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sitemap.js","sourceRoot":"","sources":["../../src/utils/sitemap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAwCnE,SAAS,YAAY,CAAC,GAAW,EAAE,OAAe,EAAE,aAAsB;IACxE,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5D,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAClD,MAAM,cAAc,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IAE7D,IAAI,OAAO,GAAG,GAAG,cAAc,GAAG,cAAc,EAAE,CAAC;IAEnD,IAAI,aAAa,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5C,OAAO,IAAI,GAAG,CAA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;GAGG;AACH,MAAM,UAAU,8BAA8B,CAC5C,OAA8C;IAE9C,OAAO,KAAK,IAAI,EAAE;QAChB,IAAI,CAAC;YACH,MAAM,KAAK,GACT,OAAO,OAAO,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;YACvF,OAAO,wBAAwB,CAC7B,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC,CACvE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,CAAC,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC;YAC5C,OAAO,IAAI,QAAQ,CAAC,2BAA2B,EAAE;gBAC/C,MAAM,EAAE,GAAG;gBACX,OAAO,EAAE,qBAAqB;aAC/B,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CMS_EDIT_WELL_KNOWN_PACKAGE_VERSION = "1.
|
|
1
|
+
export declare const CMS_EDIT_WELL_KNOWN_PACKAGE_VERSION = "1.56.0";
|
|
2
2
|
export declare const CMS_EDIT_WELL_KNOWN_CONTENT_VERSION = "a5ac82ff7d83";
|
|
3
3
|
export declare const CMS_EDIT_WELL_KNOWN_FILES: Record<string, string>;
|
|
4
4
|
export declare const CMS_EDIT_WELL_KNOWN_SKILLS: ReadonlyArray<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-cms-edit-well-known.mjs — do not edit manually.
|
|
2
|
-
export const CMS_EDIT_WELL_KNOWN_PACKAGE_VERSION = "1.
|
|
2
|
+
export const CMS_EDIT_WELL_KNOWN_PACKAGE_VERSION = "1.56.0";
|
|
3
3
|
export const CMS_EDIT_WELL_KNOWN_CONTENT_VERSION = "a5ac82ff7d83";
|
|
4
4
|
export const CMS_EDIT_WELL_KNOWN_FILES = { "core/article-structure.md": "---\nid: article-structure\ntitle: Article structure\nsummary: Article fields, article types, tags, and how templates and body content split responsibilities.\nintents: [create article, blog post, press release, case study, publication, article tags]\n---\n\n# Article structure\n\nAn `article` always belongs to an **article type**; the type decides its URL base and its template.\n\n## Fields to settle before create\n\n- `title`, `slug`, `date`, `articleType` (resolve with `list --type articleType`).\n- `description`: under about 160 characters when used for SEO.\n- `tags` and the primary tag, when the URL includes a topic segment.\n- `featuredImage` (landscape if used for social) and `visuals`, as the site playbook requires.\n- `indexed` / `hidden` per the site playbook.\n\n## Template hierarchy\n\nPeek `articleType.articleTemplate`. Its `preContent` and `postContent` already provide hero, byline or CTA components. Do not repeat those in the article's `content`.\n\n## Body content\n\n- Follow the **source order**. Do not invent side-by-side layouts unless the source is a true pair.\n- Merge continuous prose into fewer body blocks when nothing visual sits between.\n- Do not rewrite source copy. Structure and place it; flag problems to the human.\n- Rename every `cmsLabel` away from \"New ...\".\n\n## Flow\n\nRead site playbooks (`articles`, `defaults`, `routing`) → `index sync` → `create from-json --dry-run --strict` → confirm → create → `diff` → `save` → preview-verify. Save is draft only.\n", "core/core-cms-rules.md": "---\nid: core-cms-rules\ntitle: Core CMS editing rules\nsummary: Draft-only saves, publish gates, asset reuse, staged uploads, and what an agent must never do.\nintents: [cms rules, safety, publish, upload image, edit content, get started, help]\n---\n\n# Core CMS editing rules\n\n## Drafts and publishing\n\n- `save` writes **drafts only**. Publish, unpublish, archive and delete go through `plan`, then `apply` after an explicit yes from the user, and only when the signed-in role allows it.\n- A plan publishes only the ids it lists. Pass `--with-parents` when a parent or listing page must go live too.\n- For a published entry that is being deleted, ask whether to unpublish-then-delete or unpublish-then-archive. Never choose for the user.\n\n## Editing\n\n- Work from the real space: `schema` for fields and enums, `index sync` for lookups. Do not guess field names.\n- Build whole trees with `create from-json` (`--dry-run --strict` first) or `export from-json` / `apply from-json`. Use `set`, `rtf` and `add` only for small patches.\n- Always `diff` before `save`.\n- Hosted MCP rejects inline JSON or text over 8192 bytes: use a staged upload (`kind=json` or `kind=text`) and the `--staged` flag.\n- Other locales: pass `--locale <code>`; an edit in the default locale can leave other locales stale.\n\n## Assets\n\n- **Reuse first.** `index sync`, then `asset search` (by title, file name or concept).\n- Raster and video go through `cms_edit_request_staged_upload`, then `cms_edit_media` prepare, wait, catalog, import with real alt text. Never `asset upload` jpeg, png, webp, gif or mp4.\n- SVG, PDF and Lottie use a staged upload, then `asset upload --staged`.\n- Write alt text from what the picture shows. Do not emotion-score people, logos, icons or illustrations.\n\n## Never\n\n- Never publish as a side effect of saving.\n- Never rewrite source copy while structuring it.\n- Never put secrets, tokens or personal data into content, feedback reports, or tool arguments.\n- If a tag, type or field you need does not exist and CMS writes to the model are off, stop and ask.\n\n## Feedback\n\nIf a tool misbehaves or something is missing, offer the user a `report_feedback` report. Send it only after they agree, and keep code, secrets and personal data out of it.\n", "core/page-structure.md": "---\nid: page-structure\ntitle: Page structure\nsummary: The three content slots of a page, required fields, and how to build a page tree safely.\nintents: [create page, create landing page, new marketing page, page layout, clone page]\n---\n\n# Page structure\n\nA `page` is the root of a web page's content tree.\n\n## Fields\n\n| Field | Notes |\n|---|---|\n| `slug` | Required. No leading or trailing slash. `index` is the home page. Multi-level: `part1/part2`. |\n| `title` | Required. On-page heading, and the document title when `metaTitle` is empty. |\n| `metaTitle` | Optional search-result title. Does not change the on-page heading. |\n| `description` | SEO meta description. Aim for 120-160 characters. |\n| `indexed`, `hidden` | Search indexing and sitemap exclusion. Test or agent pages: `indexed: false`. |\n| `template` | Link to a template for shared layout slots. |\n| `featuredImage` | Asset used for social sharing. Landscape. |\n| `cmsLabel` | Label in the CMS entry list. Defaults to `title`. |\n\n## Content slots (rendered in order)\n\n- `topContent`: above the main area (nav, announcement, hero when the page owns its hero).\n- `content`: the main area. **Default target for `add` and `create from-json`.**\n- `bottomContent`: below the main area (newsletter, closing CTA).\n\nEach slot holds links to `component`, `collection` or `externalComponent` entries.\n\n## Building a page\n\n1. Read the site's own playbooks first (`cms_edit_customer`: `index`, `routing`, `components-index`).\n2. `cms_edit schema component` for this space's real fields and enums.\n3. Draft one `create from-json` payload (nested `components`, discriminator `type`). Use staged JSON above 8 KB.\n4. `create from-json --dry-run --strict`, review, then create.\n5. After each `add`, set `heading`, then rename `cmsLabel` away from \"New ...\".\n6. Confirm slug, title and template with the user. `diff` before `save`.\n\nDo not hand-write a code route for a marketing URL. A page is a CMS slug on the catch-all route.\n", "core/spacing-rules.md": "---\nid: spacing-rules\ntitle: Spacing rules\nsummary: Vertical rhythm between sections is set by the section component and tokens, never by empty components.\nintents: [spacing, gap, padding, margin, empty section, whitespace, layout gap]\n---\n\n# Spacing rules\n\nSpacing is a property of the design system, not of the content.\n\n1. **Sections own their spacing.** Every marketing block renders inside the shared section wrapper, which applies the project's section spacing and column grid. Content does not add its own.\n2. **Do not add filler.** No empty components, blank paragraphs, ` ` or line-break stacks to push sections apart. If the gap looks wrong, the cause is a component choice or a token, and the fix is there.\n3. **Adjacent sections share a background rhythm.** Two neighbours with the same background colour read as one block; vary background colours deliberately, or use the component's own spacing options if it has them.\n4. **Width is columns, not pixels.** Layout width inside a section is a column span from the project's grid. Do not request fixed pixel widths from content.\n5. **If a gap needs a code change** (a new spacing option, a token), stop and report it. Do not work around it in CMS content.\n6. **Verify at four widths**: 375, 1024, 1440 and 1920 px. Spacing that looks right at 1440 often collapses or balloons at the extremes.\n", "core/templates.md": "---\nid: templates\ntitle: Templates (layout shells)\nsummary: How templates wrap pages and articles with preContent, postContent, menu, footer and colours.\nintents: [create template, edit template, shared layout, site chrome, menu, footer]\n---\n\n# Templates\n\nA **template** is a layout shell shared by many pages or articles. It carries:\n\n| Field | Type | Meaning |\n|---|---|---|\n| `preContent` | array of links | Components rendered before the entry's own content (sticky nav, hero, announcement bar). |\n| `postContent` | array of links | Components rendered after it (newsletter signup, closing CTA). |\n| `menu`, `footer` | single navigation link | Site chrome for this template. |\n| `backgroundColour`, `textColour` | project colour names | Default colours for the shell. |\n\n## Rules\n\n1. **Check the template before adding layout to an entry.** Peek the entry's `template` (pages) or its article type's `articleTemplate` (articles). If the template already supplies a hero or CTA, do not add another to the entry's `content`.\n2. **Edit shared shells deliberately.** A template change affects every entry that uses it. Say so in the plan and ask for a clear yes.\n3. **Reuse before creating.** `list --type template` first. Do not create a near-duplicate for one page.\n4. Set menu and footer with `set @ref menu <nav-entry-id> --link` (same for `footer`). Colours use the project's colour names, not hex.\n5. Name templates for what they are for (\"Campaign landing\", \"Article default\"), not for the first page that used them.\n\n## Workflow\n\n`create template --label \"<name>\"` → `open` it → `add` components to `preContent` / `postContent` → set `menu`, `footer`, colours → `diff` → `save`. Save writes drafts only. Publishing is a separate, explicit step.\n", "core/top-content-heroes.md": "---\nid: top-content-heroes\ntitle: Top content and heroes\nsummary: Where heroes live, the single-h1 rule, and how to avoid duplicate heroes from templates.\nintents: [add hero, change hero, top content, page header, h1, hero image]\n---\n\n# Top content and heroes\n\n## Where a hero goes\n\n- If the **template** already provides a hero in `preContent`, the entry gets none.\n- Otherwise the hero is the **first component in `topContent`** (pages) or the first body component (articles whose template has none).\n- Never put a hero in `content` just because `topContent` looked unfamiliar.\n\n## One `h1`\n\nExactly one component per rendered page owns the `h1`. Check the hero component's heading level fields (and `isHero` on HTML components). A second hero, or a hero plus a template header, produces two `h1`s. Fix by removing one, not by restyling.\n\n## Setting a hero\n\n1. Pick the hero type from the site's `components-index` playbook; do not invent a type.\n2. Set `heading`, then `showHeading` per the component's rules, then `cmsLabel` (name it for the page: \"Pricing hero\").\n3. Images: reuse an existing asset first (`index sync`, then `asset search`). Write real alt text from the picture. Wide heroes want landscape sources; the pipeline processes the file, do not hand-resize.\n4. Colours use project colour names. Check text contrast against the chosen background and image overlay.\n5. Check the result on the preview at 375, 1024, 1440 and 1920 px wide. A hero that works at 1440 can still break at 1920 or 375.\n\n## Do not\n\n- Do not use a hero to carry long copy; use a body block below it.\n- Do not change a shared template's hero to fix one page.\n" };
|
|
5
5
|
export const CMS_EDIT_WELL_KNOWN_SKILLS = [{ "id": "article-structure", "title": "Article structure", "summary": "Article fields, article types, tags, and how templates and body content split responsibilities.", "intents": ["create article", "blog post", "press release", "case study", "publication", "article tags"], "scope": "core", "path": "core/article-structure.md", "sha256": "3b09b08c029b2282885d552497cfe0b5d357902349ef91b6abcdf833f868d3ab", "bytes": 1495 }, { "id": "core-cms-rules", "title": "Core CMS editing rules", "summary": "Draft-only saves, publish gates, asset reuse, staged uploads, and what an agent must never do.", "intents": ["cms rules", "safety", "publish", "upload image", "edit content", "get started", "help"], "scope": "core", "path": "core/core-cms-rules.md", "sha256": "c1981f971f7460b83a13115b2fd25cd6de93d1171c42b560b23f98bff97cdbe5", "bytes": 2243 }, { "id": "page-structure", "title": "Page structure", "summary": "The three content slots of a page, required fields, and how to build a page tree safely.", "intents": ["create page", "create landing page", "new marketing page", "page layout", "clone page"], "scope": "core", "path": "core/page-structure.md", "sha256": "503efb77887702d6a834e73bdb37bfb5de1ffc3f0fe6d96aa45d1a9678a59de0", "bytes": 1977 }, { "id": "spacing-rules", "title": "Spacing rules", "summary": "Vertical rhythm between sections is set by the section component and tokens, never by empty components.", "intents": ["spacing", "gap", "padding", "margin", "empty section", "whitespace", "layout gap"], "scope": "core", "path": "core/spacing-rules.md", "sha256": "e496bcf444a52aaec62685cc1ed1d289b858389bd0518e882f987e8b6057a4cd", "bytes": 1359 }, { "id": "templates", "title": "Templates (layout shells)", "summary": "How templates wrap pages and articles with preContent, postContent, menu, footer and colours.", "intents": ["create template", "edit template", "shared layout", "site chrome", "menu", "footer"], "scope": "core", "path": "core/templates.md", "sha256": "ca5796c2f174b7a33c26b9a17ca3bac28073e7471f75261c7541d365be62325b", "bytes": 1762 }, { "id": "top-content-heroes", "title": "Top content and heroes", "summary": "Where heroes live, the single-h1 rule, and how to avoid duplicate heroes from templates.", "intents": ["add hero", "change hero", "top content", "page header", "h1", "hero image"], "scope": "core", "path": "core/top-content-heroes.md", "sha256": "420fd12b0f354290fda1ecd73edb1fae5ca9c433a525bad1345fb13c4de570bd", "bytes": 1647 }];
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Config-driven site files (`@se-studio/core-ui/site-files`)
|
|
2
|
+
|
|
3
|
+
A site holds **one** config file, `src/lib/site-files.config.ts`, exporting `siteFiles` (built with
|
|
4
|
+
`defineSiteFiles`). `generate-marketing-routes <app> --write` writes every standard site file as a thin
|
|
5
|
+
`@generated` wrapper that calls a core factory with that config. No site hand-writes these files.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { defineSiteFiles } from '@se-studio/core-ui/site-files';
|
|
9
|
+
|
|
10
|
+
export const siteFiles = defineSiteFiles({
|
|
11
|
+
site: { appName: 'my-site', port: 3014, baseUrl, isProduction },
|
|
12
|
+
cms: { getContentfulConfig, preview: buildInformation.preview ?? false, revalidationSecret },
|
|
13
|
+
discovery: { componentMap, componentFieldsMap, collectionMap, collectionFieldsMap, collectionCardFieldsMap, externalComponentMap, palette },
|
|
14
|
+
revalidate: { onAfterRevalidate },
|
|
15
|
+
content: {
|
|
16
|
+
customerName, siteTitle, siteDescription, source, license,
|
|
17
|
+
getAllPageLinks, getAllArticleLinks, getAllArticleTypeLinks, getAllPersonLinks, getAllTagLinks,
|
|
18
|
+
enablePerson, enableTag, enableArticleTypeIndex, enablePrimaryTagPartOfSlug,
|
|
19
|
+
articlesSlug, articlesBase, articleTypeRoutes, peopleSlug, peopleBase, personTypeSlugs,
|
|
20
|
+
tagsSlug, tagsBase, tagTypeSlugs,
|
|
21
|
+
articleIndexPath, teamIndexPath, tagUrl,
|
|
22
|
+
},
|
|
23
|
+
llms: { getPageDiscovery },
|
|
24
|
+
llmsFull: { getMarkdown, maxDocuments: 25 },
|
|
25
|
+
siteInfo: { publicationTypeSlugs: ['publications'] },
|
|
26
|
+
markdownIndex: {},
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Files and factories (step 2)
|
|
31
|
+
|
|
32
|
+
| File | Factory | Config |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| `src/app/cms.txt/route.ts` | `cmsTxtRoute` | `site.appName`, `site.port`, `cmsTxt.extraContent` |
|
|
35
|
+
| `src/app/.well-known/se-studio/cms-edit/[[...path]]/route.ts` | `cmsEditWellKnownRoute` | none |
|
|
36
|
+
| `src/app/download/[assetId]/[filename]/route.ts` | `downloadRoute` | `cms`, `site.baseUrl` |
|
|
37
|
+
| `src/app/og/[imageId]/route.tsx` | `ogImageRoute` | `cms` |
|
|
38
|
+
| `src/app/api/cms/discovery/route.ts` | `cmsDiscoveryRoute` | `discovery` |
|
|
39
|
+
| `src/app/api/revalidate/route.ts` | `revalidateRoute` | `cms.revalidationSecret`, `revalidate.*` |
|
|
40
|
+
|
|
41
|
+
## `(cms-dev)` tree, markdown route and root layout (step 5)
|
|
42
|
+
|
|
43
|
+
| File | Factory | Config |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| `src/app/layout.tsx` | `rootLayout` + `rootMetadata` | `root` |
|
|
46
|
+
| `src/app/markdown/[...params]/route.ts` | `markdownRoute` | `markdown`, `site.baseUrl`, `cms` |
|
|
47
|
+
| `src/app/(cms-dev)/layout.tsx` | `cmsDevLayout` | `site.isProduction` |
|
|
48
|
+
| `src/app/(cms-dev)/CmsDevAnalyticsProvider.tsx` | client re-export from `@se-studio/core-ui/site-files/client` | none |
|
|
49
|
+
| `.../cms/guidelines.md/route.ts` | `cmsGuidelinesRoute` | none |
|
|
50
|
+
| `.../cms/media.json/route.ts`, `.../cms/media.md/route.ts` | `cmsMediaJsonRoute`, `cmsMediaMarkdownRoute` | `cms`, `site.isProduction` |
|
|
51
|
+
| `.../cms/media/page.tsx`, `.../cms/media/[kind]/page.tsx` | `cmsMediaHubPage`, `cmsMediaKindPage` | `cms` |
|
|
52
|
+
| `.../cms/preview/render/page.tsx` | `cmsPreviewRenderPage` | `cmsDev.rendererConfig`, `cmsDev.converterContext`, `cmsDev.contentContext` |
|
|
53
|
+
| `.../cms/screenshot/route.ts` | `cmsScreenshotRoute` | none (literal `dynamic = 'force-dynamic'`) |
|
|
54
|
+
| `.../cms/showcase/page.tsx`, `.../render/page.tsx`, `.../render-all/page.tsx` | `cmsShowcasePage`, `cmsShowcaseRenderPage`, `cmsShowcaseRenderAllPage` | `cmsDev` |
|
|
55
|
+
| `.../test/videos/page.tsx` and `VideoTestScenario.tsx` | `testVideosPage`, client re-export | none |
|
|
56
|
+
|
|
57
|
+
The client files are generated as `'use client'` re-exports of components in core-ui, so the generated file is the
|
|
58
|
+
client boundary at the path Next expects.
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
cmsDev: {
|
|
62
|
+
rendererConfig, converterContext,
|
|
63
|
+
componentMockMap, collectionMockMap, collectionCardMockMap,
|
|
64
|
+
excludedComponents, excludedCollections,
|
|
65
|
+
showcaseMocks,
|
|
66
|
+
},
|
|
67
|
+
markdown: {
|
|
68
|
+
converterContext, buildOptions, source, license,
|
|
69
|
+
routes: { articleRoutes, articlesBaseIsPage, articlesSlug, tagsSlug, peopleSlug, personTypeSlugs, personTypeIndexSlugs,
|
|
70
|
+
tagTypeSlugs, enablePrimaryTagPartOfSlug, enablePeopleIndex, enableTagsIndex, requireCustomTypeForArticleTypes },
|
|
71
|
+
fetch: { getAllArticleLinks, getRelatedArticles, getAllPageLinks },
|
|
72
|
+
extensions: async () => ({ customConverters, collectionHydrators, externalHydrators, listingHydrators }),
|
|
73
|
+
},
|
|
74
|
+
root: { title, description, icons, htmlClassNames: [fontA.variable], defaultOgImageId: 'home', ogImageIds: ['home'] },
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- `cmsDev`: the field maps default to `discovery`'s and the palette to `discovery.palette`. `showcaseMocks` (the curated
|
|
78
|
+
mocks file) is merged over the registration mocks with `mergeShowcaseMocks`; unset means the registration mocks as they are.
|
|
79
|
+
`contentContext` overrides the context `/cms/preview/render` renders with.
|
|
80
|
+
- `markdown`: the handler resolves the path, fetches the item, hydrates listing, external and collection caches, converts it, and
|
|
81
|
+
answers `text/markdown` with `Cache-Control: public, s-maxage=3600, stale-while-revalidate`, `Link: <canonical>; rel="canonical"`
|
|
82
|
+
and `X-Robots-Tag: noindex` (404 `Content not found`, 500 `Internal Server Error`). `extensions` may be a function so heavy
|
|
83
|
+
converter and hydrator modules load for this route only; `@se-studio/markdown-renderer` itself is imported on the first request.
|
|
84
|
+
`external` and listing hydrators are only wired when configured. `pathPrefix` (for example `api/markdown`) is stripped from the
|
|
85
|
+
start of the request path for a site that mounts the route under a catch-all elsewhere. `getContentfulConfig` defaults to `cms.getContentfulConfig`.
|
|
86
|
+
- `root`: `htmlClassNames` come first in the `<html>` class list, then `antialiased` (set `antialiased: false` to drop it), then
|
|
87
|
+
the `DEBUG_TAILWIND` and `SHOW_SECTION_OUTLINE` flags. `defaultOgImageId` adds `openGraph.images` pointing at `/og/<id>`; unset
|
|
88
|
+
leaves the output unchanged. `ogImageIds` is the list of ids the site's `/og/<imageId>` route serves (read with `ogImageIds(config)`),
|
|
89
|
+
and a default id outside it is rejected.
|
|
90
|
+
## Discovery files (step 3)
|
|
91
|
+
|
|
92
|
+
| File | Factory | Config |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| `src/app/llms.txt/route.ts` | `llmsTxtRoute` | `content`, `llms.*` |
|
|
95
|
+
| `src/app/llms-full.txt/route.ts` | `llmsFullTxtRoute` | `content`, `llmsFull.*` (opt-in) |
|
|
96
|
+
| `src/app/site-info.md/route.ts` | `siteInfoRoute` | `content`, `siteInfo.*` |
|
|
97
|
+
| `src/app/markdown-index.txt/route.ts` | `markdownIndexRoute` | `content`, `markdownIndex.*` |
|
|
98
|
+
|
|
99
|
+
All four read the one shared `content` section: identity (`customerName`, `siteTitle`, `siteDescription`,
|
|
100
|
+
`source`, `license`), the link getters, the marketing flags, the route slugs and optional URL helpers
|
|
101
|
+
(`articleIndexPath`, `teamIndexPath`, `tagUrl`, which default to the standard layout built from the slugs).
|
|
102
|
+
`site.baseUrl` supplies absolute URLs. The per-file sections only hold options and every option has a default
|
|
103
|
+
(see `LlmsTxtSettings`, `SiteInfoSettings`, `MarkdownIndexSettings` in `@se-studio/markdown-renderer/site-files`):
|
|
104
|
+
|
|
105
|
+
- `llms`: key page and latest article selection (`selectKeyPages`, `selectLatestArticles`, `latestArticlesLimit`),
|
|
106
|
+
`getPageDiscovery(pages)` for site-specific page descriptions and a Documents section (the logic that finds
|
|
107
|
+
documents stays in the site), `markdownUrlPattern`, `details`, `customBlocks`, `optionalLinks`.
|
|
108
|
+
- `llmsFull`: `getMarkdown(href)` (required) returns the markdown of one site path, typically from the same
|
|
109
|
+
exporter and converter as the `/markdown/[...params]` route. The file lists the key pages and latest
|
|
110
|
+
articles after the llms.txt header and is bounded by `maxDocuments` (default 25) and `maxBytes` (default
|
|
111
|
+
512 KiB). Without the `llmsFull` section the route answers 404.
|
|
112
|
+
- `siteInfo`: `publicationTypeSlugs`, `intro`, `tagName`, `appendSections`, `now` (the clock behind the
|
|
113
|
+
`Last updated` line, injected in tests).
|
|
114
|
+
- `markdownIndex`: `adjustLinks`.
|
|
115
|
+
|
|
116
|
+
The generated route answers 404 (it never throws at import) when the section it needs is absent: without
|
|
117
|
+
`content` all four, without `llmsFull` only `llms-full.txt`. Every file is generated with the literal
|
|
118
|
+
`export const revalidate = 3600;`.
|
|
119
|
+
| `src/app/robots.txt/route.ts` | `robotsTxtRoute` | `robots` (any `formatRobotsTxt` option, incl. `blockedUserAgents`), `site.isProduction` (boolean or `{ envVar }`) |
|
|
120
|
+
| `src/app/sitemap.xml/route.ts` | `sitemapRoute` | `sitemap` (`getEntries`, `redirectMap`, `extraEntries`, `excludeEntry`, `applySlugGuard` default on, `sitemapIndex`) |
|
|
121
|
+
| `src/app/sitemap-unindexed.xml/route.ts` | `sitemapUnindexedRoute` | same `sitemap` section |
|
|
122
|
+
|
|
123
|
+
A missing `robots`/`sitemap` section is not an error at import: the sitemap routes answer 404. A sitemap data error answers 503.
|
|
124
|
+
|
|
125
|
+
Route segment config that Next reads statically (`revalidate`, `dynamic`) is a literal in the generated file.
|
|
126
|
+
|
|
127
|
+
## The guard
|
|
128
|
+
|
|
129
|
+
`check-marketing-routes` (the `check:routes` script every site runs in CI) fails when the config exists and
|
|
130
|
+
a generated file is missing, was edited, or is a hand-written copy. A site that keeps a file by hand lists
|
|
131
|
+
it in `marketing-routes.json`:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
"allowHandWrittenSiteFiles": [{ "file": "src/app/cms.txt/route.ts", "reason": "adds a bespoke section" }]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The reason is required (at least 8 characters). A site without the config is not touched; it only gets a
|
|
138
|
+
warning that it has hand-written copies.
|
|
139
|
+
|
|
140
|
+
## Fonts
|
|
141
|
+
|
|
142
|
+
`next/font` objects cannot be used outside the root layout (a route handler bundle fails with a
|
|
143
|
+
`ReferenceError`), so they stay in the site's `src/project/font.ts`. When that file exists the generated
|
|
144
|
+
`src/app/layout.tsx` does `import * as fonts from '@/project/font'` and passes it to `rootLayout`, which adds
|
|
145
|
+
the `variable` class of every export (in export-name order) before `root.htmlClassNames`. Do not import fonts
|
|
146
|
+
in `site-files.config.ts`.
|
package/docs/llms.md
CHANGED
|
@@ -493,3 +493,10 @@ export const { GET, HEAD } = createOgImageHandler({
|
|
|
493
493
|
2. Never import preview helpers from `cms-server` inside component/collection files — use `getPreviewFieldProps` from `@se-studio/core-ui` instead.
|
|
494
494
|
3. Pass `previewHelpers` as a prop to `<Section>` and `rendererConfig` to `<SectionLinks>`.
|
|
495
495
|
4. Server components can call Contentful fetch functions; client components cannot.
|
|
496
|
+
|
|
497
|
+
## Config-driven site files
|
|
498
|
+
|
|
499
|
+
`@se-studio/core-ui/site-files`: `defineSiteFiles`, and the route factories `cmsTxtRoute`, `cmsEditWellKnownRoute`,
|
|
500
|
+
`downloadRoute`, `ogImageRoute`, `cmsDiscoveryRoute`, `revalidateRoute`. A site keeps one `src/lib/site-files.config.ts`; `generate-marketing-routes --write` writes the thin route files. See `docs/SITE_FILES.md`.
|
|
501
|
+
|
|
502
|
+
Robots: `blockedUserAgents` (+ `blockedUserAgentsPosition`, `blockedUserAgentsEnvironments`) writes `User-agent: <ua>` / `Disallow: /` groups. Sitemap: `excludeEntry`, `applySlugGuard`, `onError` (a data error answers 503), `createSitemapIndexRouteHandler`. `isProductionDeployment({ envVar })` reads the production flag from a named env var.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/core-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.56.0",
|
|
4
4
|
"description": "Shared React UI component library with Tailwind CSS v4 for SE Studio applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,6 +39,14 @@
|
|
|
39
39
|
"./form-analytics": {
|
|
40
40
|
"types": "./dist/analytics/formAnalyticsEntry.d.ts",
|
|
41
41
|
"import": "./dist/analytics/formAnalyticsEntry.js"
|
|
42
|
+
},
|
|
43
|
+
"./site-files": {
|
|
44
|
+
"types": "./dist/site-files/index.d.ts",
|
|
45
|
+
"import": "./dist/site-files/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./site-files/client": {
|
|
48
|
+
"types": "./dist/site-files/client.d.ts",
|
|
49
|
+
"import": "./dist/site-files/client.js"
|
|
42
50
|
}
|
|
43
51
|
},
|
|
44
52
|
"files": [
|
|
@@ -89,8 +97,9 @@
|
|
|
89
97
|
"@contentful/rich-text-react-renderer": "^16.2.2",
|
|
90
98
|
"@contentful/rich-text-types": "^17.2.7",
|
|
91
99
|
"@radix-ui/react-slot": "1.3.3",
|
|
92
|
-
"@se-studio/contentful-rest-api": "2.
|
|
100
|
+
"@se-studio/contentful-rest-api": "2.10.0",
|
|
93
101
|
"@se-studio/core-data-types": "2.3.0",
|
|
102
|
+
"@se-studio/markdown-renderer": "2.1.0",
|
|
94
103
|
"@types/mustache": "4.2.6",
|
|
95
104
|
"@vimeo/player": "^2.30.4",
|
|
96
105
|
"clsx": "^2.1.1",
|