Files
bbeandCursor 6023991f5c feat: add SEO metadata, llms.txt, and markdown page mirrors
Centralize site metadata and social URLs for JSON-LD, expose llmstxt.org
content and per-page .md routes for LLM crawlers, and refactor blog/FAQ/events
pages with shared components.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 00:59:41 +02:00

39 lines
1.1 KiB
TypeScript

import { apiUrl } from "./api-base";
/**
* Server-side fetch of the public site settings (social links, titles, …).
* Cached/revalidated so it doesn't hit the backend on every render.
*/
export async function fetchPublicSettings(): Promise<Record<string, string>> {
try {
const res = await fetch(apiUrl("/settings/public"), {
next: { revalidate: 3600 },
});
if (!res.ok) return {};
return (await res.json()) as Record<string, string>;
} catch {
return {};
}
}
/** Setting keys that hold a public social/profile URL, in display order. */
const SOCIAL_SETTING_KEYS = [
"telegram_link",
"nostr_link",
"x_link",
"youtube_link",
"discord_link",
"linkedin_link",
] as const;
/**
* Build the list of real social URLs for schema.org `sameAs` from settings.
* Only includes entries that are actually configured (non-empty, http(s)).
*/
export function socialUrlsFromSettings(
settings: Record<string, string>,
): string[] {
return SOCIAL_SETTING_KEYS.map((key) => settings[key]?.trim())
.filter((url): url is string => !!url && /^https?:\/\//i.test(url));
}