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:
@@ -9,17 +9,23 @@ import Button from '@/components/ui/Button';
|
||||
import Card from '@/components/ui/Card';
|
||||
import { CalendarIcon, MapPinIcon } from '@heroicons/react/24/outline';
|
||||
|
||||
export default function NextEventSection() {
|
||||
interface NextEventSectionProps {
|
||||
initialEvent?: Event | null;
|
||||
}
|
||||
|
||||
export default function NextEventSection({ initialEvent }: NextEventSectionProps) {
|
||||
const { t, locale } = useLanguage();
|
||||
const [nextEvent, setNextEvent] = useState<Event | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [nextEvent, setNextEvent] = useState<Event | null>(initialEvent ?? null);
|
||||
const [loading, setLoading] = useState(!initialEvent);
|
||||
|
||||
useEffect(() => {
|
||||
// Skip fetch if we already have server-provided data
|
||||
if (initialEvent !== undefined) return;
|
||||
eventsApi.getNextUpcoming()
|
||||
.then(({ event }) => setNextEvent(event))
|
||||
.catch(console.error)
|
||||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
}, [initialEvent]);
|
||||
|
||||
const formatDate = (dateStr: string) => {
|
||||
return new Date(dateStr).toLocaleDateString(locale === 'es' ? 'es-ES' : 'en-US', {
|
||||
|
||||
@@ -2,8 +2,13 @@
|
||||
|
||||
import { useLanguage } from '@/context/LanguageContext';
|
||||
import NextEventSection from './NextEventSection';
|
||||
import { Event } from '@/lib/api';
|
||||
|
||||
export default function NextEventSectionWrapper() {
|
||||
interface NextEventSectionWrapperProps {
|
||||
initialEvent?: Event | null;
|
||||
}
|
||||
|
||||
export default function NextEventSectionWrapper({ initialEvent }: NextEventSectionWrapperProps) {
|
||||
const { t } = useLanguage();
|
||||
|
||||
return (
|
||||
@@ -13,7 +18,7 @@ export default function NextEventSectionWrapper() {
|
||||
{t('home.nextEvent.title')}
|
||||
</h2>
|
||||
<div className="mt-12 max-w-3xl mx-auto">
|
||||
<NextEventSection />
|
||||
<NextEventSection initialEvent={initialEvent} />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user