From 160994f5312bd80c64aab9840a6f1b4a43261a08 Mon Sep 17 00:00:00 2001 From: FOLX Bot Date: Mon, 17 Aug 2026 19:37:06 +0200 Subject: [PATCH] Neobstojec clanek vrne pravi 404 z noindex namesto naslovnice s canonical na / --- server/static.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/server/static.ts b/server/static.ts index 015c4e7..1ea7b7f 100644 --- a/server/static.ts +++ b/server/static.ts @@ -182,6 +182,24 @@ export function serveStatic(app: Express) { res.status(200).set({ "Content-Type": "text/html" }).end(template); return; } + + // Clanka s tem slugom ni. Brez tega bi SPA vrnil HTTP 200 z naslovnico + // in canonical na "/" — Google to bere kot podvojeno naslovnico (soft 404), + // izbrisani clanki pa ostanejo v indeksu in v Discovru. + { + let template = await fs.promises.readFile(indexPath, "utf-8"); + template = stripExistingMeta(template); + template = template.replace( + /[^<]*<\/title>/, + [ + '<meta name="robots" content="noindex, follow" />', + '<meta name="description" content="Dieser Artikel ist nicht mehr verfuegbar." />', + '<title>Artikel nicht gefunden | Folx Music Television', + ].join("\n "), + ); + res.status(404).set({ "Content-Type": "text/html" }).end(template); + return; + } } catch (e) { } }