Update social media sharing with video details and improved thumbnails
Update server-side rendering to correctly inject Open Graph and Twitter card metadata, including dynamic video titles, descriptions, and optimized thumbnail URLs for social media sharing. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ab9cd02a-d0b2-4288-9ceb-1964d0059648 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/ab9cd02a-d0b2-4288-9ceb-1964d0059648/xVB32z7
This commit is contained in:
parent
cc0cfe3120
commit
faed7a9b62
@ -99,21 +99,27 @@ app.use((req, res, next) => {
|
||||
`<meta property="og:image" content="${thumbnailUrl}"`
|
||||
);
|
||||
|
||||
// Dodamo dodatne OG oznake za video
|
||||
// Zamenjamo tudi Twitter image
|
||||
template = template.replace(
|
||||
/<meta name="twitter:image" content="[^"]*"/,
|
||||
`<meta name="twitter:image" content="${thumbnailUrl}"`
|
||||
);
|
||||
|
||||
template = template.replace(
|
||||
/<meta name="twitter:title" content="[^"]*"/,
|
||||
`<meta name="twitter:title" content="${escapeHtml(video.title)}"`
|
||||
);
|
||||
|
||||
template = template.replace(
|
||||
/<meta name="twitter:description" content="[^"]*"/,
|
||||
`<meta name="twitter:description" content="${escapeHtml(video.description || `Watch ${video.title} on go4.video`)}"`
|
||||
);
|
||||
|
||||
// Dodamo dodatne OG oznake za video (samo tiste, ki jih ni v osnovnem template-u)
|
||||
const additionalMeta = `
|
||||
<meta property="og:url" content="${videoUrl}">
|
||||
<meta property="og:type" content="video.other">
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="630">
|
||||
<meta property="og:image:type" content="image/png">
|
||||
<meta property="og:video:duration" content="${video.duration}">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:title" content="${escapeHtml(video.title)}">
|
||||
<meta name="twitter:description" content="${escapeHtml(video.description || `Watch ${video.title} on go4.video`)}">
|
||||
<meta name="twitter:image" content="${thumbnailUrl}">
|
||||
<meta name="twitter:image:width" content="1200">
|
||||
<meta name="twitter:image:height" content="630">`;
|
||||
<meta property="og:video:duration" content="${video.duration}">`;
|
||||
|
||||
template = template.replace('</head>', `${additionalMeta}\n</head>`);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user