Files
anouma/app/robots.ts
T

44 lines
1.3 KiB
TypeScript

import type { MetadataRoute } from "next";
import { getSiteUrl, isSiteIndexable } from "@/lib/seo/config";
// Reads the CMS's SEO settings (site URL override, robots kill switch) on
// every request - must not be statically prerendered at build time.
export const dynamic = "force-dynamic";
export default async function robots(): Promise<MetadataRoute.Robots> {
const [siteUrl, indexable] = await Promise.all([getSiteUrl(), isSiteIndexable()]);
if (!indexable) {
// Global kill switch (SEO-Einstellungen → "Website für Suchmaschinen
// sichtbar") - block everything rather than list exceptions.
return { rules: [{ userAgent: "*", disallow: "/" }] };
}
return {
rules: [
{
userAgent: "*",
allow: "/",
disallow: [
// Admin panel and its API.
"/admin",
"/admin/*",
"/api/*",
// Customer accounts - never public.
"/konto",
"/konto/*",
"/login",
"/registrieren",
"/auth/*",
// Private calendar-subscription feed (secret-token URLs).
"/calendar/*",
// Meeting join/call flow - session-gated, never a page worth indexing.
"/termine/*/beitreten",
"/termine/*/call",
],
},
],
sitemap: `${siteUrl}/sitemap.xml`,
};
}