SEO: keywords in articleSection sledita znacki kosa (folx-badge marker)
Stran je vsakemu clanku v <meta name=keywords> pisala Volksmusik, Schlager -- tudi neglasbenim (Becker, Geissens, Ana Ivanovic) -- in v JSON-LD dajala articleSection iz kategorije, ki je pri vseh nasih clankih News. Zdaj SSR prebere marker <!--folx-badge:STAR NEWS--> iz vsebine clanka (isti vzorec kot <!--folx-updated:...-->, ker tabela articles nima stolpca za to): MUSIC NEWS (ali brez markerja) -> Volksmusik, Schlager, Musik News / Musik News karkoli drugega -> Star News, Promi News, Promi / Star News Brez markerja ostane vedenje nespremenjeno, da starejsi clanki ne nazadujejo. Besedilne zaznave namenoma ni: preizkus na 30 clankih jo je zgresil pri ZDF-Fernsehgartnu in pri Wayne Carpendaleju. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HcwnGD7Je9Z4sKiHDJhEwP
This commit is contained in:
co-authored by
Claude Opus 5
parent
ea3cd47fe6
commit
48f8e16cda
+19
-2
@@ -4,6 +4,22 @@ import path from "path";
|
||||
import { storage } from "./storage";
|
||||
import sharp from "sharp";
|
||||
|
||||
// 15. 9. 2026 (Sebastjan): stran je v keywords vsakemu clanku pisala
|
||||
// "Volksmusik, Schlager" — tudi Beckerju, Geissensom in Ivanovic. Cevovod ze ve,
|
||||
// kaj kos je (znacka MUSIC NEWS / STAR NEWS), zato jo zapise v vsebino kot
|
||||
// marker <!--folx-badge:STAR NEWS-->, enako kot <!--folx-updated:...-->.
|
||||
// Brez markerja ostane vse kot prej (glasbeno), da starejsi clanki ne nazadujejo.
|
||||
// Besedilne zaznave namenoma NI: preizkus na 30 clankih jo je zgresil pri
|
||||
// Fernsehgartnu in Carpendaleju.
|
||||
function folxGenre(article: any): { words: string[]; section: string } {
|
||||
const m = /<!--\s*folx-badge:\s*([^>]*?)\s*-->/i.exec(String(article?.content || ""));
|
||||
const badge = (m ? m[1] : "MUSIC NEWS").toUpperCase();
|
||||
return badge === "MUSIC NEWS"
|
||||
? { words: ["Volksmusik", "Schlager", "Musik News"], section: "Musik News" }
|
||||
: { words: ["Star News", "Promi News", "Promi"], section: "Star News" };
|
||||
}
|
||||
|
||||
|
||||
function escapeHtml(str: string): string {
|
||||
return str.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
||||
}
|
||||
@@ -501,7 +517,8 @@ export function serveStatic(app: Express) {
|
||||
"image": [finalImage],
|
||||
"datePublished": pubDate,
|
||||
"dateModified": modDate,
|
||||
"articleSection": article.category || "News",
|
||||
"articleSection": folxGenre(article).section,
|
||||
"keywords": folxGenre(article).words.join(", "),
|
||||
"author": {
|
||||
"@type": "Organization",
|
||||
"name": article.author || "Folx Music Television",
|
||||
@@ -550,7 +567,7 @@ export function serveStatic(app: Express) {
|
||||
`<meta name="twitter:description" content="${escapeHtml(article.excerpt)}" />`,
|
||||
`<meta name="twitter:image" content="${escapeHtml(finalImage)}" />`,
|
||||
`<meta name="description" content="${escapeHtml(article.excerpt)}" />`,
|
||||
`<meta name="keywords" content="Volksmusik, Schlager, ${escapeHtml(article.title)}, ${escapeHtml(article.category || 'News')}, FOLX TV" />`,
|
||||
`<meta name="keywords" content="${escapeHtml(folxGenre(article).words.join(", "))}, ${escapeHtml(article.title)}, ${escapeHtml(article.category || 'News')}, FOLX TV" />`,
|
||||
`<link rel="canonical" href="${escapeHtml(articleUrl)}" />`,
|
||||
`<title>${escapeHtml(article.title)} - Volksmusik & Schlager | Folx Music Television</title>`,
|
||||
jsonLdTag,
|
||||
|
||||
+17
-1
@@ -7,6 +7,22 @@ import path from "path";
|
||||
import { nanoid } from "nanoid";
|
||||
import { storage } from "./storage";
|
||||
|
||||
// 15. 9. 2026 (Sebastjan): stran je v keywords vsakemu clanku pisala
|
||||
// "Volksmusik, Schlager" — tudi Beckerju, Geissensom in Ivanovic. Cevovod ze ve,
|
||||
// kaj kos je (znacka MUSIC NEWS / STAR NEWS), zato jo zapise v vsebino kot
|
||||
// marker <!--folx-badge:STAR NEWS-->, enako kot <!--folx-updated:...-->.
|
||||
// Brez markerja ostane vse kot prej (glasbeno), da starejsi clanki ne nazadujejo.
|
||||
// Besedilne zaznave namenoma NI: preizkus na 30 clankih jo je zgresil pri
|
||||
// Fernsehgartnu in Carpendaleju.
|
||||
function folxGenre(article: any): { words: string[]; section: string } {
|
||||
const m = /<!--\s*folx-badge:\s*([^>]*?)\s*-->/i.exec(String(article?.content || ""));
|
||||
const badge = (m ? m[1] : "MUSIC NEWS").toUpperCase();
|
||||
return badge === "MUSIC NEWS"
|
||||
? { words: ["Volksmusik", "Schlager", "Musik News"], section: "Musik News" }
|
||||
: { words: ["Star News", "Promi News", "Promi"], section: "Star News" };
|
||||
}
|
||||
|
||||
|
||||
const viteLogger = createLogger();
|
||||
|
||||
function escapeHtml(str: string): string {
|
||||
@@ -102,7 +118,7 @@ export async function setupVite(server: Server, app: Express) {
|
||||
`<meta name="twitter:description" content="${escapeHtml(article.excerpt)}" />`,
|
||||
`<meta name="twitter:image" content="${escapeHtml(finalImage)}" />`,
|
||||
`<meta name="description" content="${escapeHtml(article.excerpt)}" />`,
|
||||
`<meta name="keywords" content="Volksmusik, Schlager, ${escapeHtml(article.title)}, ${escapeHtml(article.category || 'News')}, FOLX TV" />`,
|
||||
`<meta name="keywords" content="${escapeHtml(folxGenre(article).words.join(", "))}, ${escapeHtml(article.title)}, ${escapeHtml(article.category || 'News')}, FOLX TV" />`,
|
||||
`<link rel="canonical" href="${escapeHtml(articleUrl)}" />`,
|
||||
`<title>${escapeHtml(article.title)} - Volksmusik & Schlager | Folx Music Television</title>`,
|
||||
].join("\n ");
|
||||
|
||||
Reference in New Issue
Block a user