feat: agregar funcionalidad para obtener organizaciones públicas y actualizar el sitemap con rutas dinámicas

This commit is contained in:
2026-09-16 10:44:54 -03:00
parent 60eb940d3e
commit eff1988d66
6 changed files with 175 additions and 1 deletions
+38 -1
View File
@@ -165,7 +165,44 @@ export async function GET() {
console.error("Error generating sitemap:", error);
}
const allRoutes = [...staticRoutes, ...videoRoutes, ...authRoutes, ...marketingRoutes, ...explorationRoutes, ...legalRoutes, ...serviceRoutes];
let orgRoutes: SitemapRoute[] = [];
try {
let currentPage = 1;
let totalPages = 1;
do {
const orgsResult = await ApiServerService.post<{
data: { slug: string; name: string; description: string; creationDate?: string }[];
page: number;
pages: number;
}>("views/public-organizations", {
page: currentPage,
limit: 1000,
});
if (orgsResult && orgsResult.data) {
totalPages = orgsResult.pages || 1;
const newRoutes = orgsResult.data.map((org) => ({
url: `${baseUrl}/landing/org/${org.slug}`,
changeFrequency: "weekly" as const,
priority: 0.8,
}));
orgRoutes = [...orgRoutes, ...newRoutes];
} else {
break;
}
currentPage++;
} while (currentPage <= totalPages);
} catch (error) {
console.error("Error generating org sitemap:", error);
}
const allRoutes = [...staticRoutes, ...videoRoutes, ...authRoutes, ...marketingRoutes, ...orgRoutes, ...explorationRoutes, ...legalRoutes, ...serviceRoutes];
const sitemapXml = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"