diff --git a/website/README.md b/website/README.md index b5fb834..6085b3f 100644 --- a/website/README.md +++ b/website/README.md @@ -39,6 +39,8 @@ changes. - `tests/site.test.ts` checks the tagged showrecorder.app links and where "Get the beta" goes. - `tests/metadata.test.ts` checks the title and description lengths, the canonical address, and that the share image is a 1200 x 630 PNG on the Open Graph card and a large Twitter card. +- `tests/robots.test.ts` checks that robots.txt allows every crawler, names the AI crawlers (`AI_CRAWLERS` in + `lib/site.ts`) and blocks nothing. - `tests/analytics.test.ts` checks the PostHog setup, the `?internal=1` opt-out and the Content-Security-Policy. ## Where things live diff --git a/website/app/robots.ts b/website/app/robots.ts index b4137c5..f91211f 100644 --- a/website/app/robots.ts +++ b/website/app/robots.ts @@ -1,8 +1,12 @@ import type { MetadataRoute } from "next"; -import { SITE_URL } from "@/lib/site"; +import { AI_CRAWLERS, SITE_URL } from "@/lib/site"; export const dynamic = "force-static"; export default function robots(): MetadataRoute.Robots { - return { rules: { userAgent: "*", allow: "/" }, sitemap: `${SITE_URL}/sitemap.xml` }; + return { + // Every crawler first (search engines), then the AI crawlers by name (lib/site.ts). + rules: [{ userAgent: "*", allow: "/" }, ...AI_CRAWLERS.map((userAgent) => ({ userAgent, allow: "/" }))], + sitemap: `${SITE_URL}/sitemap.xml`, + }; } diff --git a/website/lib/site.ts b/website/lib/site.ts index 835f599..33ba636 100644 --- a/website/lib/site.ts +++ b/website/lib/site.ts @@ -21,3 +21,21 @@ const SHOWRECORDER_URL = "https://showrecorder.app"; export function showRecorderLink(path = "/", campaign: "landing" | "llms" = "landing"): string { return `${SHOWRECORDER_URL}${path}?utm_source=soundcheckplayer&utm_campaign=${campaign}`; } + +// The crawlers that feed AI search and assistants, named in robots.txt so the policy is explicit: all of them may +// read the site. The same list as showrecorder.app; training crawlers (Google-Extended, Applebot-Extended, CCBot) +// are included on purpose. +export const AI_CRAWLERS = [ + "GPTBot", + "OAI-SearchBot", + "ChatGPT-User", + "ClaudeBot", + "Claude-SearchBot", + "Claude-User", + "PerplexityBot", + "Perplexity-User", + "Google-Extended", + "Applebot", + "Applebot-Extended", + "CCBot", +]; diff --git a/website/tests/robots.test.ts b/website/tests/robots.test.ts new file mode 100644 index 0000000..46e9548 --- /dev/null +++ b/website/tests/robots.test.ts @@ -0,0 +1,25 @@ +import robots from "@/app/robots"; +import { AI_CRAWLERS } from "@/lib/site"; + +// robots.txt names the crawlers behind AI search and assistants, so the policy is stated: all of them may read the +// site. The first rule (every crawler) and the sitemap line are for search engines and stay as they were. + +const rules = [robots().rules].flat(); + +describe("robots.txt", () => { + it("still allows every crawler first and names the sitemap", () => { + expect(rules[0]).toEqual({ userAgent: "*", allow: "/" }); + expect(robots().sitemap).toBe("https://soundcheckplayer.app/sitemap.xml"); + }); + + it("names the AI crawlers, each allowed everywhere", () => { + for (const bot of ["GPTBot", "OAI-SearchBot", "ChatGPT-User", "ClaudeBot", "PerplexityBot", "Google-Extended"]) { + expect(AI_CRAWLERS).toContain(bot); + } + expect(rules.slice(1)).toEqual(AI_CRAWLERS.map((userAgent) => ({ userAgent, allow: "/" }))); + }); + + it("blocks nothing", () => { + for (const r of rules) expect(r.disallow).toBeUndefined(); + }); +});