diff --git a/client/index.html b/client/index.html index b9d9056..408cf81 100644 --- a/client/index.html +++ b/client/index.html @@ -26,7 +26,7 @@ - + diff --git a/server/static.ts b/server/static.ts index d9d471f..e08e0c9 100644 --- a/server/static.ts +++ b/server/static.ts @@ -75,6 +75,20 @@ export function serveStatic(app: Express) { const pubDate = article.publishedAt ? new Date(article.publishedAt as any).toISOString() : new Date().toISOString(); + + // dateModified: ce je clanek dopolnjen (enrich), preberi marker + const modDate = (() => { + const mm = //.exec(article.content || ""); + if (mm) { try { return new Date(mm[1]).toISOString(); } catch (e) { /* ignore */ } } + return pubDate; + })(); + + // VideoObject: ce je v clanku vgrajen YouTube video + const videoId = (() => { + const mm = /youtube(?:-nocookie)?\.com\/embed\/([A-Za-z0-9_-]{6,})/.exec(article.content || ""); + return mm ? mm[1] : null; + })(); + const jsonLd = { "@context": "https://schema.org", "@type": "NewsArticle", @@ -82,7 +96,7 @@ export function serveStatic(app: Express) { "description": article.excerpt, "image": [finalImage], "datePublished": pubDate, - "dateModified": pubDate, + "dateModified": modDate, "articleSection": article.category || "News", "author": { "@type": "Organization", @@ -104,6 +118,25 @@ export function serveStatic(app: Express) { }; const jsonLdTag = ``; + const videoLd = videoId ? { + "@context": "https://schema.org", + "@type": "VideoObject", + "name": article.title, + "description": article.excerpt, + "thumbnailUrl": [`https://i.ytimg.com/vi/${videoId}/maxresdefault.jpg`], + "uploadDate": pubDate, + "embedUrl": `https://www.youtube.com/embed/${videoId}`, + "contentUrl": `https://www.youtube.com/watch?v=${videoId}`, + "publisher": { + "@type": "Organization", + "name": "Folx Music Television", + "logo": { "@type": "ImageObject", "url": `${canonicalBase}/og-image.jpg` }, + }, + } : null; + const videoLdTag = videoLd + ? `` + : ""; + const ogTags = [ ``, ``, @@ -116,7 +149,7 @@ export function serveStatic(app: Express) { ``, ``, ``, - ``, + ``, ``, ``, ``, @@ -126,6 +159,7 @@ export function serveStatic(app: Express) { ``, `${escapeHtml(article.title)} - Volksmusik & Schlager | Folx Music Television`, jsonLdTag, + videoLdTag, ].join("\n "); template = template.replace(/[^<]*<\/title>/, ogTags); diff --git a/server/vite.ts b/server/vite.ts index ce7f3a4..32fe19a 100644 --- a/server/vite.ts +++ b/server/vite.ts @@ -96,7 +96,7 @@ export async function setupVite(server: Server, app: Express) { `<meta property="og:image:type" content="image/jpeg" />`, `<meta property="og:site_name" content="Folx Music Television" />`, `<meta property="og:locale" content="de_DE" />`, - `<meta property="fb:pages" content="1428520781492675" />`, + `<meta property="fb:pages" content="281200958640258" />`, `<meta name="twitter:card" content="summary_large_image" />`, `<meta name="twitter:title" content="${escapeHtml(article.title)}" />`, `<meta name="twitter:description" content="${escapeHtml(article.excerpt)}" />`,