From df15293ea32432ffe8e9f6505135bd7be84d06c5 Mon Sep 17 00:00:00 2001 From: FOLX Bot Date: Mon, 17 Aug 2026 20:14:31 +0200 Subject: [PATCH] Rubrike z onemusic.news dobijo noindex in gredo iz sitemapov; v API in na TV sidebar ostanejo --- server/routes.ts | 7 +++++++ server/static.ts | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/server/routes.ts b/server/routes.ts index f9255b8..b573925 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -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(` \n ${SITE}${p}\n daily\n ${p === "/" ? "1.0" : "0.7"}\n `); } 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(` \n ${SITE}/article/${xmlEscape(a.slug)}\n ${lastmod}\n weekly\n 0.8\n `); } @@ -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; }); diff --git a/server/static.ts b/server/static.ts index 1ea7b7f..002e9ce 100644 --- a/server/static.ts +++ b/server/static.ts @@ -25,6 +25,19 @@ function ogImageUrl(coverImage: string, baseUrl: string): string { return imgPath.startsWith("http") ? imgPath : `${baseUrl}${imgPath}`; } +// Rubrike, ki jih pisemo enkrat in objavimo tudi na onemusic.news. Besedilo je +// isto na obeh domenah, zato jih na folx.tv drzimo zunaj Googlovega indeksa — +// v bazi in v /api/articles ostanejo, ker jih bere sidebar na TV kanalih. +const ONE_RUBRIKEN = new Set(["Politik", "Promis", "Sport", "Musik & Film", "Wetter", "Finanzen", "Aktuelles"]); + +function setRobots(html: string, content: string): string { + const tag = ``; + if (/]*>/i.test(html)) { + return html.replace(/]*>/i, tag); + } + return html.replace("", ` ${tag}\n `); +} + function stripExistingMeta(html: string): string { html = html.replace(/]*>\s*/gi, ""); html = html.replace(/]*>\s*/gi, ""); @@ -179,6 +192,10 @@ export function serveStatic(app: Express) { ].join("\n"); template = template.replace('
', () => `
${ssrBlock}
`); + if (ONE_RUBRIKEN.has(article.category || "")) { + template = setRobots(template, "noindex, follow, max-image-preview:large"); + } + res.status(200).set({ "Content-Type": "text/html" }).end(template); return; }