progmaweb
The site and account service of Progmasoft: a Next.js frontend and an ASP.NET Core API.
Clonegit clone https://git.progmasoft.com/progmaweb
mainroot / apps / web / app / robots.ts
// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
// SPDX-License-Identifier: AGPL-3.0-or-later
import type { MetadataRoute } from "next";
import { headers } from "next/headers";
export default async function robots(): Promise<MetadataRoute.Robots> {
const requestHeaders = await headers();
const host =
requestHeaders.get("x-forwarded-host") ?? requestHeaders.get("host") ?? "";
const canonicalHost = host.split(":", 1)[0]?.toLowerCase();
// Progmasoft OAuth and the Progmasoft Console have sign-in, consent and
// developer pages only; none of them is a search document.
if (
canonicalHost === "credentials.progmasoft.com" ||
canonicalHost === "authorize.progmasoft.com" ||
canonicalHost === "console.progmasoft.com"
) {
return { rules: [{ userAgent: "*", disallow: "/" }] };
}
// Each host with pages of its own names its own sitemap.
const sitemap =
canonicalHost === "product.progmasoft.com" ||
canonicalHost === "license.progmasoft.com" ||
canonicalHost === "agencelandmcp.progmasoft.com" ||
canonicalHost === "git.progmasoft.com"
? `https://${canonicalHost}/sitemap.xml`
: "https://progmasoft.com/sitemap.xml";
return {
rules: [
{ userAgent: "Googlebot", allow: "/" },
{ userAgent: "Google-Extended", allow: "/" },
{ userAgent: "OAI-SearchBot", allow: "/" },
{ userAgent: "ChatGPT-User", allow: "/" },
{ userAgent: "GPTBot", disallow: "/" },
{ userAgent: "Claude-SearchBot", allow: "/" },
{ userAgent: "Claude-User", allow: "/" },
{ userAgent: "ClaudeBot", allow: "/" },
{ userAgent: "CCBot", disallow: "/" },
{ userAgent: "Bytespider", disallow: "/" },
{ userAgent: "*", allow: "/" },
],
sitemap,
};
}