diff --git a/app/fastify-entry.ts b/app/fastify-entry.ts index dcbac11..bbf16da 100644 --- a/app/fastify-entry.ts +++ b/app/fastify-entry.ts @@ -73,6 +73,11 @@ async function startServer() { app.post<{ Body: string }>("/_telefunc", createHandler(telefuncHandler)()); + app.get("/sitemap.xml", async (_request, reply) => { + reply.type("application/xml"); + reply.send(sitemap.getSitemap()); + }); + /** * Vike route * diff --git a/app/services/Sitemap.ts b/app/services/Sitemap.ts index f36a283..c38fd7b 100644 --- a/app/services/Sitemap.ts +++ b/app/services/Sitemap.ts @@ -151,6 +151,11 @@ class Sitemap { }); } + public getSitemap(): string { + if (!this.sitemap) this.generateSitemap(); + return this.sitemap; + } + public generateSitemap(): void { console.log("Generating sitemap...");