Neobstojec clanek vrne pravi 404 z noindex namesto naslovnice s canonical na /

This commit is contained in:
FOLX Bot 2026-08-17 19:37:06 +02:00
parent 11e61e5405
commit 160994f531

View File

@ -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>[^<]*<\/title>/,
[
'<meta name="robots" content="noindex, follow" />',
'<meta name="description" content="Dieser Artikel ist nicht mehr verfuegbar." />',
'<title>Artikel nicht gefunden | Folx Music Television</title>',
].join("\n "),
);
res.status(404).set({ "Content-Type": "text/html" }).end(template);
return;
}
} catch (e) {
}
}