SEO: VideoObject JSON-LD + dateModified iz folx-updated markerja; fb:pages popravek (281200958640258)
This commit is contained in:
parent
69d400a209
commit
262636ef52
@ -26,7 +26,7 @@
|
|||||||
<meta name="twitter:title" content="Volksmusik & Schlager TV | FOLX Music Television" />
|
<meta name="twitter:title" content="Volksmusik & Schlager TV | FOLX Music Television" />
|
||||||
<meta name="twitter:description" content="FOLX TV – Ihr Fernsehsender Nr. 1 für Volksmusik und Schlager. Aktuelle Nachrichten, Musikvideos und Live-Shows." />
|
<meta name="twitter:description" content="FOLX TV – Ihr Fernsehsender Nr. 1 für Volksmusik und Schlager. Aktuelle Nachrichten, Musikvideos und Live-Shows." />
|
||||||
<meta name="twitter:image" content="https://folx.tv/og-image.jpg" />
|
<meta name="twitter:image" content="https://folx.tv/og-image.jpg" />
|
||||||
<meta property="fb:pages" content="1428520781492675" />
|
<meta property="fb:pages" content="281200958640258" />
|
||||||
<meta name="facebook-domain-verification" content="b4y482htm54uybm563tfr1ucb1n46w" />
|
<meta name="facebook-domain-verification" content="b4y482htm54uybm563tfr1ucb1n46w" />
|
||||||
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1" />
|
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1" />
|
||||||
<link rel="canonical" href="https://folx.tv/" />
|
<link rel="canonical" href="https://folx.tv/" />
|
||||||
|
|||||||
@ -75,6 +75,20 @@ export function serveStatic(app: Express) {
|
|||||||
const pubDate = article.publishedAt
|
const pubDate = article.publishedAt
|
||||||
? new Date(article.publishedAt as any).toISOString()
|
? new Date(article.publishedAt as any).toISOString()
|
||||||
: new Date().toISOString();
|
: new Date().toISOString();
|
||||||
|
|
||||||
|
// dateModified: ce je clanek dopolnjen (enrich), preberi marker <!--folx-updated:ISO-->
|
||||||
|
const modDate = (() => {
|
||||||
|
const mm = /<!--folx-updated:([^>]+?)-->/.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 = {
|
const jsonLd = {
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
"@type": "NewsArticle",
|
"@type": "NewsArticle",
|
||||||
@ -82,7 +96,7 @@ export function serveStatic(app: Express) {
|
|||||||
"description": article.excerpt,
|
"description": article.excerpt,
|
||||||
"image": [finalImage],
|
"image": [finalImage],
|
||||||
"datePublished": pubDate,
|
"datePublished": pubDate,
|
||||||
"dateModified": pubDate,
|
"dateModified": modDate,
|
||||||
"articleSection": article.category || "News",
|
"articleSection": article.category || "News",
|
||||||
"author": {
|
"author": {
|
||||||
"@type": "Organization",
|
"@type": "Organization",
|
||||||
@ -104,6 +118,25 @@ export function serveStatic(app: Express) {
|
|||||||
};
|
};
|
||||||
const jsonLdTag = `<script type="application/ld+json">${JSON.stringify(jsonLd).replace(/</g, "\\u003c")}</script>`;
|
const jsonLdTag = `<script type="application/ld+json">${JSON.stringify(jsonLd).replace(/</g, "\\u003c")}</script>`;
|
||||||
|
|
||||||
|
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
|
||||||
|
? `<script type="application/ld+json">${JSON.stringify(videoLd).replace(/</g, "\\u003c")}</script>`
|
||||||
|
: "";
|
||||||
|
|
||||||
const ogTags = [
|
const ogTags = [
|
||||||
`<meta property="og:title" content="${escapeHtml(article.title)}" />`,
|
`<meta property="og:title" content="${escapeHtml(article.title)}" />`,
|
||||||
`<meta property="og:description" content="${escapeHtml(article.excerpt)}" />`,
|
`<meta property="og:description" content="${escapeHtml(article.excerpt)}" />`,
|
||||||
@ -116,7 +149,7 @@ export function serveStatic(app: Express) {
|
|||||||
`<meta property="og:image:type" content="image/jpeg" />`,
|
`<meta property="og:image:type" content="image/jpeg" />`,
|
||||||
`<meta property="og:site_name" content="Folx Music Television" />`,
|
`<meta property="og:site_name" content="Folx Music Television" />`,
|
||||||
`<meta property="og:locale" content="de_DE" />`,
|
`<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:card" content="summary_large_image" />`,
|
||||||
`<meta name="twitter:title" content="${escapeHtml(article.title)}" />`,
|
`<meta name="twitter:title" content="${escapeHtml(article.title)}" />`,
|
||||||
`<meta name="twitter:description" content="${escapeHtml(article.excerpt)}" />`,
|
`<meta name="twitter:description" content="${escapeHtml(article.excerpt)}" />`,
|
||||||
@ -126,6 +159,7 @@ export function serveStatic(app: Express) {
|
|||||||
`<link rel="canonical" href="${escapeHtml(articleUrl)}" />`,
|
`<link rel="canonical" href="${escapeHtml(articleUrl)}" />`,
|
||||||
`<title>${escapeHtml(article.title)} - Volksmusik & Schlager | Folx Music Television</title>`,
|
`<title>${escapeHtml(article.title)} - Volksmusik & Schlager | Folx Music Television</title>`,
|
||||||
jsonLdTag,
|
jsonLdTag,
|
||||||
|
videoLdTag,
|
||||||
].join("\n ");
|
].join("\n ");
|
||||||
|
|
||||||
template = template.replace(/<title>[^<]*<\/title>/, ogTags);
|
template = template.replace(/<title>[^<]*<\/title>/, ogTags);
|
||||||
|
|||||||
@ -96,7 +96,7 @@ export async function setupVite(server: Server, app: Express) {
|
|||||||
`<meta property="og:image:type" content="image/jpeg" />`,
|
`<meta property="og:image:type" content="image/jpeg" />`,
|
||||||
`<meta property="og:site_name" content="Folx Music Television" />`,
|
`<meta property="og:site_name" content="Folx Music Television" />`,
|
||||||
`<meta property="og:locale" content="de_DE" />`,
|
`<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:card" content="summary_large_image" />`,
|
||||||
`<meta name="twitter:title" content="${escapeHtml(article.title)}" />`,
|
`<meta name="twitter:title" content="${escapeHtml(article.title)}" />`,
|
||||||
`<meta name="twitter:description" content="${escapeHtml(article.excerpt)}" />`,
|
`<meta name="twitter:description" content="${escapeHtml(article.excerpt)}" />`,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user