preusmeritev rubrik na news.folx.tv mora biti pred obravnavo /category, sicer se ne sprozi
This commit is contained in:
+29
-29
@@ -300,6 +300,35 @@ 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---- /category/<ime>: prej je vrnil HTML naslovnice s canonical "/" in
|
// ---- /category/<ime>: prej je vrnil HTML naslovnice s canonical "/" in
|
||||||
// brez vsebine, kar je Google bral kot soft 404 / podvojeno naslovnico ----
|
// brez vsebine, kar je Google bral kot soft 404 / podvojeno naslovnico ----
|
||||||
const catMatch = url.match(/^\/category\/([^?#\/]+)/);
|
const catMatch = url.match(/^\/category\/([^?#\/]+)/);
|
||||||
@@ -382,35 +411,6 @@ 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\/([^?#]+)/);
|
const articleMatch = url.match(/^\/article\/([^?#]+)/);
|
||||||
if (articleMatch) {
|
if (articleMatch) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user