Aktuelles preseljen na news.folx.tv: 301 s /article/<slug>, /category/<rubrika> in /aktuelles
This commit is contained in:
@@ -382,11 +382,44 @@ export function serveStatic(app: Express) {
|
||||
}
|
||||
}
|
||||
|
||||
// 29. 8. 2026: rubrike Aktuelles so preseljene na loceno stran news.folx.tv.
|
||||
// Clanki ostanejo v bazi in v /api/articles (bere jih news.folx.tv in TV sidebar),
|
||||
// na folx.tv pa se naslovi trajno preusmerijo.
|
||||
const NEWS_HOST = "https://news.folx.tv";
|
||||
const NEWS_RUBRIK_SLUG: Record<string, string | undefined> = {
|
||||
"Politik": "politik",
|
||||
"Promis": "promis",
|
||||
"Sport": "sport",
|
||||
"Musik & Film": "musik-film",
|
||||
"Wetter": "wetter",
|
||||
"Finanzen": "finanzen",
|
||||
"Aktuelles": "",
|
||||
};
|
||||
const pathOnly = url.split("?")[0].split("#")[0];
|
||||
if (/^\/aktuelles\/?$/.test(pathOnly)) {
|
||||
res.redirect(301, `${NEWS_HOST}/`);
|
||||
return;
|
||||
}
|
||||
const catRedirect = pathOnly.match(/^\/category\/([^/]+)\/?$/);
|
||||
if (catRedirect) {
|
||||
const catName = decodeURIComponent(catRedirect[1]);
|
||||
const key = Array.from(ONE_RUBRIKEN).find((r) => r.toLowerCase() === catName.toLowerCase());
|
||||
if (key) {
|
||||
const rs = NEWS_RUBRIK_SLUG[key];
|
||||
res.redirect(301, rs ? `${NEWS_HOST}/rubrik/${rs}` : `${NEWS_HOST}/`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const articleMatch = url.match(/^\/article\/([^?#]+)/);
|
||||
if (articleMatch) {
|
||||
try {
|
||||
const slug = decodeURIComponent(articleMatch[1]);
|
||||
const article = await storage.getArticleBySlug(slug);
|
||||
if (article && ONE_RUBRIKEN.has((article as any).category || "")) {
|
||||
res.redirect(301, `${NEWS_HOST}/${article.slug}`);
|
||||
return;
|
||||
}
|
||||
if (article && (article as any).targetUrl) {
|
||||
res.redirect(302, (article as any).targetUrl);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user