From 55101f8637d1cb4cf324521a630a9b5b53881884 Mon Sep 17 00:00:00 2001 From: feco Date: Fri, 20 Nov 2026 02:11:26 +0000 Subject: [PATCH] Sitemap for the public pages, linked from robots.txt Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL --- services/frontend/src/app/robots.ts | 5 ++++- services/frontend/src/app/sitemap.ts | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 services/frontend/src/app/sitemap.ts diff --git a/services/frontend/src/app/robots.ts b/services/frontend/src/app/robots.ts index e29362a..ed6d5f6 100644 --- a/services/frontend/src/app/robots.ts +++ b/services/frontend/src/app/robots.ts @@ -1,5 +1,7 @@ import type { MetadataRoute } from "next"; +import { siteUrl } from "@/lib/share"; + // AI crawlers that train models or answer from the site: they load pages // far more often than visitors do. Link preview robots (Facebook, Messenger, // Slack, WhatsApp, X, LinkedIn) stay allowed, they make the shared links work. @@ -38,8 +40,9 @@ const AI_CRAWLERS = [ "Scrapy", ]; -export default function robots(): MetadataRoute.Robots { +export default async function robots(): Promise { return { + sitemap: `${await siteUrl()}/sitemap.xml`, rules: [ { userAgent: AI_CRAWLERS, disallow: "/" }, // Logged-in pages redirect anyway; shared links carry noindex. diff --git a/services/frontend/src/app/sitemap.ts b/services/frontend/src/app/sitemap.ts new file mode 100644 index 0000000..d7b97db --- /dev/null +++ b/services/frontend/src/app/sitemap.ts @@ -0,0 +1,15 @@ +import type { MetadataRoute } from "next"; + +import { siteUrl } from "@/lib/share"; + +/** The public pages for search engines; everything else needs a login. */ +export default async function sitemap(): Promise { + const base = await siteUrl(); + const privacy = { languages: { hu: `${base}/adatvedelem`, en: `${base}/privacy` } }; + return [ + { url: `${base}/`, changeFrequency: "weekly", priority: 1 }, + { url: `${base}/pelda`, changeFrequency: "monthly", priority: 0.8 }, + { url: `${base}/adatvedelem`, changeFrequency: "yearly", priority: 0.2, alternates: privacy }, + { url: `${base}/privacy`, changeFrequency: "yearly", priority: 0.2, alternates: privacy }, + ]; +} -- 2.54.0