AI / GEO: - feat(content): lexicalToMarkdown, blocksToMarkdown, createMarkdownRenderer (+markdownResponse) — per-page Markdown for AI agents - feat(content): markdown content negotiation + discovery (prefersMarkdown, markdownHref) - feat(seo): buildRobots aiBots policy (allow/block-training/disallow) - feat(seo): llms-full.txt mode in buildLlmsTxt/createLlmsTxtRoute - feat(mcp): createMcpRoute — read-only MCP server (search_content, get_page) - feat(content): searchContent + createSearchRoute — shared JSON search - feat(seo): buildSpeakableJsonLd + buildSummaryField (aiSummary, auto-fill) Forms: - feat(forms): useForm/useContactForm + validators (logic-only, no markup) - feat(forms): honeypot anti-spam (honeypotInputProps, isHoneypotTripped) Helpers / hardening: - feat(i18n): resolveLocalized — replaces ad-hoc getSafeString - feat(hooks): buildCrossLocaleFieldSync — locales from config, no hardcoded list - feat(seo): buildNoindexField — checkbox → meta.noindex, no - feat(content): resolveRedirect — 301/308 from slugHistory - feat(env): assertEnv + ipalEnvRules — fail-fast env validation - feat(consent): ConsentScript — load third-party only after consent - feat(health): createHealthRoute — Coolify/Docker DB liveness Fixes: - fix(seo): wrap getCachedPayload in try/catch in createManifestHandler (Docker/CI build no longer crashes when DB unreachable) docs: migration.md (20 sections), new env.md/mcp.md, updated agents.md, AGENTS-TEMPLATE.md, forms/hooks/content/seo/consent/deployment/richtext
37 lines
1.6 KiB
TypeScript
37 lines
1.6 KiB
TypeScript
import type { BasePayload } from 'payload';
|
|
import type { I18nConfig } from '../i18n/index.js';
|
|
type CreateSearchRouteArgs = {
|
|
/** Absolute origin to prefix result URLs with. */
|
|
baseUrl?: string;
|
|
/** Pages collection. Default 'pages'. */
|
|
collection?: string;
|
|
config: I18nConfig;
|
|
/** Default result cap when ?limit is absent. Default 10. */
|
|
defaultLimit?: number;
|
|
getCachedPayload: () => Promise<BasePayload>;
|
|
/** Home slug map/string so the home result collapses to root. */
|
|
homeSlug?: Record<string, string> | string;
|
|
/** Field holding a richer AI summary (buildSummaryField) to prefer as description. */
|
|
summaryField?: string;
|
|
};
|
|
/**
|
|
* A JSON content-search endpoint. Powers both the site's own search UI and
|
|
* external agents — one ranking, one source of truth (shares searchContent with
|
|
* the MCP server's search_content tool).
|
|
*
|
|
* // app/api/search/route.ts
|
|
* import { createSearchRoute } from '@intecion/ipal-kit'
|
|
* import { getCachedPayload } from '@/lib/content'
|
|
* import { i18nConfig } from '@/i18n.config'
|
|
* export const dynamic = 'force-dynamic'
|
|
* export const GET = createSearchRoute({ getCachedPayload, config: i18nConfig,
|
|
* baseUrl: process.env.NEXT_PUBLIC_SERVER_URL! })
|
|
*
|
|
* Query params: `q` (required), `locale`, `limit`. Response:
|
|
* { query, locale, count, results: [{ title, url, description?, slug }] }
|
|
*
|
|
* Uses the global Request/Response — no next/server import.
|
|
*/
|
|
export declare function createSearchRoute(args: CreateSearchRouteArgs): (req: Request) => Promise<Response>;
|
|
export {};
|