From fda5e2ce62191daff34f5a34263ef7015a2b2f62 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 12 Aug 2026 09:14:37 +0200 Subject: [PATCH] SSR: vsebina clanka v HTML za Google/Discover --- server/static.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/static.ts b/server/static.ts index 5adabda..d9d471f 100644 --- a/server/static.ts +++ b/server/static.ts @@ -130,6 +130,17 @@ export function serveStatic(app: Express) { template = template.replace(/[^<]*<\/title>/, ogTags); + // SSR: vgradi vsebino clanka v HTML, da jo Google/Discover vidita brez JS + const ssrBlock = [ + '<article class="ssr-content">', + `<h1>${escapeHtml(article.title)}</h1>`, + imageUrl ? `<img src="${escapeHtml(imageUrl)}" alt="${escapeHtml(article.title)}" style="max-width:100%;height:auto;" />` : "", + `<p><strong>${escapeHtml(article.excerpt)}</strong></p>`, + article.content || "", + "</article>", + ].join("\n"); + template = template.replace('<div id="root"></div>', () => `<div id="root">${ssrBlock}</div>`); + res.status(200).set({ "Content-Type": "text/html" }).end(template); return; }