video strani: iz izpisa odstranjeni hashtagi in stalni promo odstavek (bil je enak na vseh straneh), link do clanka je zdaj prava povezava in ne golo besedilo; VideoObject description uporablja ociscen opis

This commit is contained in:
folx bot
2026-08-25 11:37:38 +02:00
parent bc915249fe
commit 0b60da3593
2 changed files with 17 additions and 4 deletions
+14 -2
View File
@@ -18,6 +18,8 @@ export interface YtVideo {
durationS: number; durationS: number;
teaser: string; teaser: string;
description: string; description: string;
descriptionClean?: string;
articleUrl?: string | null;
chapters: { t: string; label: string }[]; chapters: { t: string; label: string }[];
tags: string[]; tags: string[];
previewUrl: string | null; previewUrl: string | null;
@@ -141,11 +143,21 @@ export default function VideoDetailPage() {
</section> </section>
)} )}
{v.description && ( {v.articleUrl && (
<a
href={v.articleUrl}
className="mt-3 inline-flex items-center gap-2 text-sm font-semibold text-primary hover:underline"
data-testid="link-article"
>
Ganzer Artikel auf folx.tv
</a>
)}
{(v.descriptionClean || v.description) && (
<section className="mt-8"> <section className="mt-8">
<h2 className="text-lg font-bold text-foreground mb-2">Zum Video</h2> <h2 className="text-lg font-bold text-foreground mb-2">Zum Video</h2>
<p className="whitespace-pre-line text-sm text-muted-foreground leading-relaxed"> <p className="whitespace-pre-line text-sm text-muted-foreground leading-relaxed">
{v.description.replace(/\n{3,}/g, "\n\n")} {(v.descriptionClean || v.description).replace(/\n{3,}/g, "\n\n")}
</p> </p>
</section> </section>
)} )}
+3 -2
View File
@@ -131,7 +131,7 @@ export function serveStatic(app: Express) {
const pageUrl = `${canonicalBase}/video/${v.slug}`; const pageUrl = `${canonicalBase}/video/${v.slug}`;
const poster = `${canonicalBase}${v.posterUrl}`; const poster = `${canonicalBase}${v.posterUrl}`;
const desc = (v.teaser || v.shortTitle || v.title).slice(0, 300); const desc = (v.teaser || v.shortTitle || v.title).slice(0, 300);
const longDesc = String(v.description || v.teaser || v.shortTitle) const longDesc = String(v.descriptionClean || v.description || v.teaser || v.shortTitle)
.replace(/https?:\/\/\S+/g, "").replace(/\s+/g, " ").trim().slice(0, 900); .replace(/https?:\/\/\S+/g, "").replace(/\s+/g, " ").trim().slice(0, 900);
const mins = Math.floor((v.durationS || 0) / 60), secs = (v.durationS || 0) % 60; const mins = Math.floor((v.durationS || 0) / 60), secs = (v.durationS || 0) % 60;
const embedUrl = v.embedUrl || `https://www.youtube-nocookie.com/embed/${v.ytId}`; const embedUrl = v.embedUrl || `https://www.youtube-nocookie.com/embed/${v.ytId}`;
@@ -181,7 +181,7 @@ export function serveStatic(app: Express) {
// Celoten opis gre v SSR, da ga Google prebere brez JavaScripta. // Celoten opis gre v SSR, da ga Google prebere brez JavaScripta.
// Prej je bil v HTML samo naslov in teaser (~320 znakov), ostalo je // Prej je bil v HTML samo naslov in teaser (~320 znakov), ostalo je
// izrisal sele React. // izrisal sele React.
const descHtml = String(v.description || "") const descHtml = String(v.descriptionClean || v.description || "")
.split(/\n{2,}/) .split(/\n{2,}/)
.map((par: string) => par.trim()) .map((par: string) => par.trim())
.filter((par: string) => par.length > 2 && !/^https?:\/\//.test(par) && !/^[\u2013\u2014-]{4,}$/.test(par)) .filter((par: string) => par.length > 2 && !/^https?:\/\//.test(par) && !/^[\u2013\u2014-]{4,}$/.test(par))
@@ -194,6 +194,7 @@ export function serveStatic(app: Express) {
`<p><strong>${escapeHtml(desc)}</strong></p>`, `<p><strong>${escapeHtml(desc)}</strong></p>`,
chapterHtml, chapterHtml,
`<p><a href="${escapeHtml(v.youtubeUrl)}" rel="noopener">Das ganze Video auf YouTube ansehen</a></p>`, `<p><a href="${escapeHtml(v.youtubeUrl)}" rel="noopener">Das ganze Video auf YouTube ansehen</a></p>`,
v.articleUrl ? `<p><a href="${escapeHtml(v.articleUrl)}">Ganzer Artikel auf folx.tv</a></p>` : "",
descHtml ? `<h2>Zum Video</h2>${descHtml}` : "", descHtml ? `<h2>Zum Video</h2>${descHtml}` : "",
"</article>", "</article>",
].join("\n"); ].join("\n");