agent-ecosystem/landing/server/routes/sitemap.xml.ts
iliya 0876f192fa feat(landing): enhance localization and improve UI components
- Added support for German (de), French (fr), and Japanese (ja) languages, expanding the localization capabilities of the application.
- Updated the LanguageSwitcher component to include new language options and a search feature for better user experience.
- Enhanced the HeroSection with dynamic download URLs and a release version badge for improved visibility of updates.
- Refactored the ScreenshotsSection to utilize a new data structure for screenshots, improving maintainability and performance.
- Improved the styling of various components, including the addition of search functionality in the LanguageSwitcher and adjustments to the layout of the HeroSection.
- Fixed type handling in several components to ensure better TypeScript compatibility and reduce potential runtime errors.
2026-03-23 20:18:02 +02:00

32 lines
909 B
TypeScript

import { generateSitemapRoutes } from "~/data/i18n";
const escapeXml = (value: string) =>
value
.replaceAll("&", "&")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll('"', "&quot;")
.replaceAll("'", "&apos;");
const buildDate = new Date().toISOString().split("T")[0];
export default defineEventHandler((event) => {
const config = useRuntimeConfig();
const siteUrl = (config.public.siteUrl as string) || "https://claude-agent-teams.dev";
setHeader(event, "content-type", "application/xml; charset=utf-8");
const routes = generateSitemapRoutes();
const body = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${routes
.map(
(path) =>
` <url>\n <loc>${escapeXml(`${siteUrl}${path}`)}</loc>\n <lastmod>${buildDate}</lastmod>\n </url>`
)
.join("\n")}
</urlset>
`;
return body;
});