Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/llms-txt-hub / apps/web/app/(files)/llms.txt/route.ts |
| Date | Not specified in source |
| Repository | Janady13/llms-txt-hub |
| Revision | e0f4bf978d4df168369c7601d9c5f5ea89e84377 |
| Branch | main |
| Path or archive member | apps/web/app/(files)/llms.txt/route.ts |
| Original SHA-256 | c7678a6658b8017622697172e1bdfd2e3131c6a0582ae5b8a737fdd4670dd372 |
| Git blob SHA | 9f1eb828fbb37ec93dca333970b31fae56ad5717 |
| Reading-copy SHA-256 | c7678a6658b8017622697172e1bdfd2e3131c6a0582ae5b8a737fdd4670dd372 |
Recovered source transcript
Download complete source text ↓57 lines · 1.8 KB
import { logger } from '@thedaviddias/logging'
import { NextResponse } from 'next/server'
import { getResources, getWebsites } from '@/lib/content-loader'
/**
* GET /llms.txt - Generates a text file listing all websites implementing llms.txt
* @returns Text response with website directory and resources
*/
export async function GET() {
try {
const websites = getWebsites()
const resources = getResources()
// Generate the text content
let content = `# LLMs.txt Hub Directory
## Overview
This is an automatically generated list of all websites implementing llms.txt, along with related blog posts and resources.
## Websites
The following websites have implemented llms.txt:\n\n`
// Add websites
for (const website of websites) {
content += `- [${website.name}](${website.website})${website.description ? `: ${website.description}` : ''}\n`
if (website.llmsUrl) {
content += ` - llms.txt: ${website.llmsUrl}\n`
}
if (website.llmsFullUrl) {
content += ` - Full Documentation: ${website.llmsFullUrl}\n`
}
}
// Add resources
content += '\n## Resources\n'
for (const resource of resources) {
const link = resource.url || '#'
const category = resource.category || 'general'
content += `- [${resource.title}](${link})${resource.description ? `: ${resource.description}` : ''} [${category}]\n`
}
content += `\n## Contributing
- Want to add your website? Submit a PR to our GitHub repository
- Found a bug? Open an issue
- Have questions? Join our community`
return new NextResponse(content, {
headers: {
'Content-Type': 'text/plain'
}
})
} catch (error) {
logger.error('Error generating content:', { data: error, tags: { type: 'page' } })
return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 })
}
}