Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/apps/web/app/sitemap.ts
blob: 3c89ce8ca2eaaeb2a35b236ada81e76355b86336 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// 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";
import { productSlugs } from "@/lib/products";

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
  const requestHeaders = await headers();
  const host = (
    requestHeaders.get("x-forwarded-host") ??
    requestHeaders.get("host") ??
    ""
  )
    .split(":", 1)[0]
    ?.toLowerCase();
  if (host === "viget.progmasoft.com") {
    return [
      {
        url: "https://viget.progmasoft.com/",
        changeFrequency: "weekly",
        priority: 1,
      },
      ...["c", "cpp", "objc"].map((language) => ({
        url: `https://viget.progmasoft.com/langs/${language}`,
        changeFrequency: "weekly" as const,
        priority: 0.8,
      })),
      {
        url: "https://viget.progmasoft.com/dslplugins/tazel",
        changeFrequency: "weekly",
        priority: 0.8,
      },
    ];
  }
  if (host === "catch3.uk") {
    return [
      { url: "https://catch3.uk/", changeFrequency: "weekly", priority: 1 },
    ];
  }
  if (host === "product.progmasoft.com") {
    return [
      {
        url: "https://product.progmasoft.com/",
        changeFrequency: "weekly",
        priority: 1,
      },
      ...["categories", "languages", "releases"].map((view) => ({
        url: `https://product.progmasoft.com/${view}`,
        changeFrequency: "weekly" as const,
        priority: 0.6,
      })),
      ...productSlugs.map((slug) => ({
        url: `https://product.progmasoft.com/${slug}`,
        changeFrequency: "weekly" as const,
        priority: 0.8,
      })),
    ];
  }
  return [
    {
      // Only public canonical content belongs in this sitemap. Authentication,
      // recovery, and dashboards remain discoverable to users but not Search.
      url: "https://progmasoft.com/",
      changeFrequency: "weekly",
      priority: 1,
    },
    {
      url: "https://progmasoft.com/privacy",
      changeFrequency: "yearly",
      priority: 0.3,
    },
    {
      url: "https://progmasoft.com/security",
      changeFrequency: "yearly",
      priority: 0.3,
    },
  ];
}