diff --git a/server/routes.ts b/server/routes.ts index 7318d0a..ed360e8 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -147,7 +147,7 @@ export async function registerRoutes( // POZOR: tu smejo biti samo poti, ki jih pozna React router v App.tsx. // Prej so bile "/news", "/video", "/galerie" — teh poti ni, zato je Google // dobival soft 404. Prave so "/category/News", "/videos", "/gallery". - const staticPaths = ["/", "/aktuelles", "/category/News", "/videos", "/gallery", + const staticPaths = ["/", "/category/News", "/videos", "/gallery", "/horoskop", "/rezepte", "/empfang-folx-tv", "/ueber-uns", "/kontakt", "/impressum", "/datenschutz"]; const urls: string[] = []; diff --git a/server/static.ts b/server/static.ts index d3ee480..1759ff2 100644 --- a/server/static.ts +++ b/server/static.ts @@ -357,6 +357,11 @@ export function serveStatic(app: Express) { ``, ].join("\n "); template = template.replace(/[^<]*<\/title>/, tags); + // Rubrike, ki sestavljajo /aktuelles, niso del indeksiranega dela strani: + // clanki so ze noindex, zato tudi njihov seznam ne sme v indeks. + if (Array.from(ONE_RUBRIKEN).some((r) => r.toLowerCase() === cat.toLowerCase())) { + template = setRobots(template, "noindex, follow"); + } const ssr = [ '<section class="ssr-content">', `<h1>${escapeHtml(cat)}</h1>`, @@ -606,6 +611,22 @@ export function serveStatic(app: Express) { return; } + // ---- /aktuelles: zbirna stran rubrik, ki so vse noindex. Prej je vracala + // HTML naslovnice s canonical "/", kar je Google bral kot podvojeno + // naslovnico. Zdaj ima svoj canonical in noindex, follow. ---- + if (/^\/aktuelles\/?$/.test(url.split("?")[0].split("#")[0])) { + let template = await fs.promises.readFile(indexPath, "utf-8"); + template = stripExistingMeta(template); + const aktTitle = "Aktuelles | Folx Music Television"; + template = template.replace(/<title>[^<]*<\/title>/, [ + '<meta name="robots" content="noindex, follow" />', + `<link rel="canonical" href="${canonicalBase}/aktuelles" />`, + `<title>${escapeHtml(aktTitle)}`, + ].join("\n ")); + res.status(200).set({ "Content-Type": "text/html" }).end(template); + return; + } + // Neznana pot mora vrniti PRAVI 404, sicer Google dobi soft 404 (HTTP 200 // z naslovnico). Seznam mora ustrezati potem v client/src/App.tsx. const KNOWN = [