'ai-ready:llms-txt'Type: (payload: LlmsTxtGeneratePayload) => void | Promise<void>
Called after llms.txt generation, before writing to disk. Allows you to modify the llms.txt content and add custom sections.
Payload:
content - Current llms.txt content (modify directly)fullContent - Current llms-full.txt content (modify directly)pages - All routes with their metadata (read-only)export default defineNuxtConfig({
hooks: {
'ai-ready:llms-txt': async (payload) => {
// Add custom section to llms.txt
payload.content += '\n\n## Custom Section\n\nAdded by hook!'
payload.fullContent += '\n\n## Custom Section (Full)\n\nAdded by hook!'
}
}
})
content and fullContent properties directly rather than returning values.'ai-ready:routes'Type: (payload: { routes: Record<string, string> }) => void | Promise<void>
Allows other modules to register their own AI-ready API routes. Routes will be included in llms.txt and documentation.
Payload:
routes - Record of route names to URLs (modify directly)export default defineNuxtConfig({
hooks: {
'ai-ready:routes': async (payload) => {
// Register custom API endpoint
payload.routes['Custom Search'] = '/api/custom-search'
}
}
})
'ai-ready:chunk'Type: (context: ChunkContext) => void | Promise<void>
Called during build for each generated chunk during prerendering. Allows modules to implement RAG tooling such as vector embeddings and search indexing.
Context:
chunk - The chunk data (BulkChunk with id, route, content, etc.)route - Page route (e.g., '/about')title - Page titledescription - Meta descriptionheadings - Extracted headings arrayexport default defineNuxtConfig({
hooks: {
'ai-ready:chunk': async (context) => {
// Generate embeddings for each chunk
const embedding = await generateEmbedding(context.chunk.content)
// Store in vector database
await vectorDb.insert({
id: context.chunk.id,
vector: embedding,
metadata: {
route: context.route,
title: context.title,
chunkIndex: context.chunk.chunkIndex,
}
})
}
}
})