Neobstojec clanek vrne pravi 404 z noindex namesto naslovnice s canonical na /
This commit is contained in:
parent
11e61e5405
commit
160994f531
@ -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) {
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user