1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
// SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1
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: "/" }] };
}
const sitemap =
canonicalHost === "viget.progmasoft.com"
? "https://viget.progmasoft.com/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,
};
}
|