Published your App
Replit-Commit-Author: Deployment Replit-Commit-Session-Id: 1f7e7e89-a520-4970-9645-37daadc466dc Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 2af3ef4b-c0bf-4b6c-b8fe-03f002e6dc65 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/1f7e7e89-a520-4970-9645-37daadc466dc/s81zXmM Replit-Commit-Deployment-Build-Id: a1391ce2-bc42-417e-8d9d-d695315fb7e9 Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
590c67ee7c
commit
4f906b74b4
File diff suppressed because it is too large
Load Diff
@ -533,5 +533,98 @@ export async function registerRoutes(
|
||||
}
|
||||
});
|
||||
|
||||
const ZODIAC_SIGNS = [
|
||||
"widder", "stier", "zwillinge", "krebs", "loewe", "jungfrau",
|
||||
"waage", "skorpion", "schuetze", "steinbock", "wassermann", "fische"
|
||||
];
|
||||
|
||||
app.get("/sitemap.xml", async (_req, res) => {
|
||||
try {
|
||||
const baseUrl = "https://www.folx.tv";
|
||||
const today = new Date().toISOString().split("T")[0];
|
||||
const articles = await storage.getArticles();
|
||||
const categories = [...new Set(articles.map(a => a.category).filter(Boolean))];
|
||||
|
||||
const staticPages = [
|
||||
{ loc: "/", priority: "1.0", changefreq: "daily" },
|
||||
{ loc: "/videos", priority: "0.8", changefreq: "daily" },
|
||||
{ loc: "/gallery", priority: "0.7", changefreq: "weekly" },
|
||||
{ loc: "/horoskop", priority: "0.7", changefreq: "daily" },
|
||||
{ loc: "/rezepte", priority: "0.6", changefreq: "monthly" },
|
||||
{ loc: "/empfang-folx-tv", priority: "0.5", changefreq: "monthly" },
|
||||
{ loc: "/ueber-uns", priority: "0.4", changefreq: "yearly" },
|
||||
{ loc: "/impressum", priority: "0.3", changefreq: "yearly" },
|
||||
{ loc: "/datenschutz", priority: "0.3", changefreq: "yearly" },
|
||||
];
|
||||
|
||||
let xml = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
`;
|
||||
for (const page of staticPages) {
|
||||
xml += ` <url>
|
||||
<loc>${baseUrl}${page.loc}</loc>
|
||||
<lastmod>${today}</lastmod>
|
||||
<changefreq>${page.changefreq}</changefreq>
|
||||
<priority>${page.priority}</priority>
|
||||
</url>
|
||||
`;
|
||||
}
|
||||
|
||||
for (const cat of categories) {
|
||||
xml += ` <url>
|
||||
<loc>${baseUrl}/category/${encodeURIComponent(cat)}</loc>
|
||||
<lastmod>${today}</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.6</priority>
|
||||
</url>
|
||||
`;
|
||||
}
|
||||
|
||||
for (const sign of ZODIAC_SIGNS) {
|
||||
xml += ` <url>
|
||||
<loc>${baseUrl}/horoskop/${sign}</loc>
|
||||
<lastmod>${today}</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
`;
|
||||
}
|
||||
|
||||
for (const article of articles) {
|
||||
const lastmod = article.publishedAt
|
||||
? new Date(article.publishedAt).toISOString().split("T")[0]
|
||||
: today;
|
||||
xml += ` <url>
|
||||
<loc>${baseUrl}/article/${encodeURIComponent(article.slug)}</loc>
|
||||
<lastmod>${lastmod}</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.7</priority>
|
||||
</url>
|
||||
`;
|
||||
}
|
||||
|
||||
xml += `</urlset>`;
|
||||
|
||||
res.set("Content-Type", "application/xml");
|
||||
res.set("Cache-Control", "public, max-age=3600");
|
||||
res.send(xml);
|
||||
} catch (err) {
|
||||
res.status(500).send("Error generating sitemap");
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/robots.txt", (_req, res) => {
|
||||
const robots = `User-agent: *
|
||||
Allow: /
|
||||
Disallow: /api/
|
||||
Disallow: /search
|
||||
|
||||
Sitemap: https://www.folx.tv/sitemap.xml
|
||||
`;
|
||||
res.set("Content-Type", "text/plain");
|
||||
res.set("Cache-Control", "public, max-age=86400");
|
||||
res.send(robots);
|
||||
});
|
||||
|
||||
return httpServer;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user