'use client'
import { useCallback } from 'react'
import { motion } from 'framer-motion'
import { ArrowLeft, FileEdit, Sparkles } from 'lucide-react'
import Link from 'next/link'
import Header from '@/components/Header'
import Footer from '@/components/Footer'
import { GeneratorWizard } from '@/components/generator'
import type { GeneratorData } from '@/types'
/**
* Generate llms.txt content from generator data
*/
function generateLlmsTxt(data: GeneratorData): string {
const lines: string[] = []
// Title
lines.push(`# ${data.siteName}`)
lines.push('')
// Description
if (data.description) {
lines.push(`> ${data.description}`)
lines.push('')
}
// Source URL comment
if (data.url) {
lines.push(``)
lines.push('')
}
// Sections
for (const section of data.sections) {
if (section.title.trim() || section.content.trim()) {
lines.push(`## ${section.title || 'Untitled Section'}`)
lines.push('')
lines.push(section.content || '')
lines.push('')
}
}
return lines.join('\n').trim()
}
export default function GeneratorPage() {
const handleComplete = useCallback((data: GeneratorData) => {
const content = generateLlmsTxt(data)
const slug = data.siteName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'llms'
const filename = `${slug}.txt`
const blob = new Blob([content], { type: 'text/plain' })
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = filename
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
URL.revokeObjectURL(url)
}, [])
return (
{/* Back Link */}
Back to Home
{/* Page Header */}
llms.txt Generator
Create your own llms.txt file for AI agent discovery
{/* Info Banner */}
What is llms.txt?
The llms.txt file is a standardized way to provide documentation context to AI agents.
By placing an llms.txt file at the root of your website, AI tools can automatically
discover and understand your documentation, leading to better assistance for your users.