Make next event visible to AI crawlers (SSR, JSON-LD, meta, llms.txt)
- SSR next event on homepage; pass initialEvent from server to avoid client-only content - Add schema.org Event JSON-LD on homepage when next event exists - Dynamic homepage metadata (description, OG, Twitter) with next event date - Add dynamic /llms.txt route for AI-friendly plain-text event info - Revalidation: support next-event tag; backend revalidates sitemap + next-event on event CUD - Allow /llms.txt in robots.txt Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,15 +12,19 @@ export async function POST(request: NextRequest) {
|
||||
return NextResponse.json({ error: 'Invalid secret' }, { status: 401 });
|
||||
}
|
||||
|
||||
// Validate tag
|
||||
const allowedTags = ['events-sitemap'];
|
||||
if (!tag || !allowedTags.includes(tag)) {
|
||||
// Validate tag(s) - supports single tag or array of tags
|
||||
const allowedTags = ['events-sitemap', 'next-event'];
|
||||
const tags: string[] = Array.isArray(tag) ? tag : [tag];
|
||||
const invalidTags = tags.filter((t: string) => !allowedTags.includes(t));
|
||||
if (tags.length === 0 || invalidTags.length > 0) {
|
||||
return NextResponse.json({ error: 'Invalid tag' }, { status: 400 });
|
||||
}
|
||||
|
||||
revalidateTag(tag);
|
||||
for (const t of tags) {
|
||||
revalidateTag(t);
|
||||
}
|
||||
|
||||
return NextResponse.json({ revalidated: true, tag, now: Date.now() });
|
||||
return NextResponse.json({ revalidated: true, tags, now: Date.now() });
|
||||
} catch {
|
||||
return NextResponse.json({ error: 'Failed to revalidate' }, { status: 500 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user