feat: Add route to generate sitemap in XML format
All checks were successful
Update Memento Dev on VPS / deploy (push) Successful in 3m10s

This commit is contained in:
Gauthier Daniels 2025-04-18 20:31:13 +02:00
parent 0d1e4910fb
commit 82969d08cb
2 changed files with 10 additions and 0 deletions

View File

@ -73,6 +73,11 @@ async function startServer() {
app.post<{ Body: string }>("/_telefunc", createHandler(telefuncHandler)()); app.post<{ Body: string }>("/_telefunc", createHandler(telefuncHandler)());
app.get("/sitemap.xml", async (_request, reply) => {
reply.type("application/xml");
reply.send(sitemap.getSitemap());
});
/** /**
* Vike route * Vike route
* *

View File

@ -151,6 +151,11 @@ class Sitemap {
}); });
} }
public getSitemap(): string {
if (!this.sitemap) this.generateSitemap();
return this.sitemap;
}
public generateSitemap(): void { public generateSitemap(): void {
console.log("Generating sitemap..."); console.log("Generating sitemap...");