Skip to content

generateAiTxt

function generateAiTxt(config, options): string

Defined in: ai-txt.ts:62

Generate the contents of /ai.txt (Spawning.ai-compatible format).

Returns a robots.txt-style plain-text file declaring the site’s AI training policy based on the ai_training category. If the category isn’t declared, defaults to disallow — the safer position under the EU AI Act Article 53 framework where machine-readable opt-outs are legally enforceable from August 2026.

Parameters

ParameterType
configConsentConfig
optionsAiTxtOptions

Returns

string

Example

generateAiTxt(config, { siteUrl: 'https://example.com' })
// → "# https://example.com/ai.txt
// # Generated by Tickbox from consent.config.ts
// # Policy version: 2026-05-06
//
// User-Agent: *
// Disallow: /
// "