import type { BasePayload } from 'payload'; import type { I18nConfig } from '../i18n/index.js'; import type { SitemapEntry } from './buildSitemapEntries.js'; import { type SitemapStyleOptions } from './sitemapStyle.js'; /** * Ready-made Next route handler for /llms.txt. Replaces the ~60-line try/catch * every project was copying. buildLlmsTxt already handles collections without * drafts, so no workaround is needed here. * * // app/llms.txt/route.ts * import { createLlmsTxtRoute } from '@intecion/ipal-kit' * import { getCachedPayload } from '@/lib/content' * import { i18nConfig } from '@/i18n.config' * export const dynamic = 'force-dynamic' * export const GET = createLlmsTxtRoute({ getCachedPayload, config: i18nConfig, * baseUrl: process.env.NEXT_PUBLIC_SERVER_URL! }) * * For the full-content variant, add a second route with `full: true`: * * // app/llms-full.txt/route.ts * export const GET = createLlmsTxtRoute({ getCachedPayload, config: i18nConfig, * baseUrl: process.env.NEXT_PUBLIC_SERVER_URL!, full: true }) */ export declare function createLlmsTxtRoute(opts: { getCachedPayload: () => Promise; config: I18nConfig; baseUrl: string; pagesSlug?: string; settingsSlug?: string; /** Inline every page's full Markdown (llms-full.txt). Default false. */ full?: boolean; /** Field holding a richer AI summary (buildSummaryField) to prefer as description. */ summaryField?: string; }): () => Promise; export type SitemapRouteOptions = { /** * Built-in browser look (default ON): the XML points at `?style` * and the same handler serves the CSS — nothing to copy into /public. * `false` = raw XML. Object = header/credit/accent (SitemapStyleOptions); * `title` may be async (sitemapRoute passes the Site Settings name). */ style?: false | (Omit & { title?: string | (() => Promise); }); /** Legacy: your own stylesheet URL (e.g. '/sitemap.css'). Overrides `style`. */ cssUrl?: string; }; /** * Ready-made Next route handler for /sitemap.xml, styled for humans out of the box. * Usually you don't call this — `createContentHelpers` returns `sitemapRoute`: * * // app/sitemap.xml/route.ts — the whole file * export { sitemapRoute as GET } from '@/lib/content' * export const dynamic = 'force-dynamic' * * `GET /sitemap.xml` → XML (crawlers), `GET /sitemap.xml?style` → its CSS. * Don't keep app/sitemap.ts next to it — two sitemaps confuse crawlers. */ export declare function createSitemapRouteHandler(sitemap: () => Promise, opts?: SitemapRouteOptions): (req?: Request) => Promise;