Rubrike z onemusic.news dobijo noindex in gredo iz sitemapov; v API in na TV sidebar ostanejo
This commit is contained in:
@@ -82,6 +82,11 @@ export async function registerRoutes(
|
||||
});
|
||||
|
||||
// ---- SEO: robots.txt, sitemap.xml, news sitemap, RSS ----
|
||||
// Rubrike z onemusic.news imajo isto besedilo kot tam, zato jih ne oddajamo
|
||||
// Googlu. V bazi in v /api/articles ostanejo — sidebar na TV jih potrebuje.
|
||||
const ONE_RUBRIKEN = new Set(["Politik", "Promis", "Sport", "Musik & Film", "Wetter", "Finanzen", "Aktuelles"]);
|
||||
const isOwn = (a: any) => !ONE_RUBRIKEN.has(a?.category || "");
|
||||
|
||||
const SITE = "https://folx.tv";
|
||||
const xmlEscape = (s: string) =>
|
||||
String(s || "")
|
||||
@@ -113,6 +118,7 @@ export async function registerRoutes(
|
||||
urls.push(` <url>\n <loc>${SITE}${p}</loc>\n <changefreq>daily</changefreq>\n <priority>${p === "/" ? "1.0" : "0.7"}</priority>\n </url>`);
|
||||
}
|
||||
for (const a of articles) {
|
||||
if (!isOwn(a)) continue;
|
||||
const lastmod = a.publishedAt ? new Date(a.publishedAt as any).toISOString() : new Date().toISOString();
|
||||
urls.push(` <url>\n <loc>${SITE}/article/${xmlEscape(a.slug)}</loc>\n <lastmod>${lastmod}</lastmod>\n <changefreq>weekly</changefreq>\n <priority>0.8</priority>\n </url>`);
|
||||
}
|
||||
@@ -129,6 +135,7 @@ export async function registerRoutes(
|
||||
const now = Date.now();
|
||||
const twoDays = 48 * 60 * 60 * 1000;
|
||||
const recent = articles.filter((a) => {
|
||||
if (!isOwn(a)) return false;
|
||||
const t = a.publishedAt ? new Date(a.publishedAt as any).getTime() : now;
|
||||
return now - t <= twoDays;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user