Archived
Add event structured data, canonical URLs and referrer-based traffic sources
- Event pages emit schema.org Event JSON-LD (dates, venue, image, organizer, ZAR offers, sold-out status) for Google event results. - Event pages, the events list and home page set a canonical URL so tagged and alias links don't split rankings. - Funnel tracking falls back to the referring site (Facebook, Instagram, Google, ...) and fbclid/gclid when a link has no utm_source/src. - Share and Save QR on the event page tag their links as share / qr. - getServerSettings moves to lib/serverSettings.ts for reuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import type { SiteSettings } from "@/contexts/SiteSettingsContext";
|
||||
import { API_BASE } from "@/lib/api";
|
||||
|
||||
/**
|
||||
* Server-side settings fetch, shared by the root layout (generateMetadata and
|
||||
* RootLayout) and server pages that need branding, e.g. the event page's organizer.
|
||||
* Every caller uses the identical URL + options, so Next's per-request fetch
|
||||
* memoization dedupes them into a single network call. Degrades to `{}`
|
||||
* (static defaults everywhere downstream) if the backend is unreachable at
|
||||
* request time — intentional, not a bug: branding just isn't critical enough
|
||||
* to fail the whole page render over.
|
||||
*/
|
||||
export async function getServerSettings(): Promise<SiteSettings> {
|
||||
// No API base configured: a relative fetch never settles during prerender and
|
||||
// would time out every page, so skip straight to the defaults.
|
||||
if (!API_BASE) return {};
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/api/settings`, { next: { revalidate: 60 } });
|
||||
if (!res.ok) return {};
|
||||
return await res.json();
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user