Limit video descriptions shown on social media previews

Truncate video descriptions to 150 characters for social media sharing metadata and add German text.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 401e2ec0-e00d-4f10-9d0e-60f3d479f9a5
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: e6407904-6889-470d-a46c-6618087a2b78
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/60d372ff-2c10-46c7-b01b-10c3435136b0/401e2ec0-e00d-4f10-9d0e-60f3d479f9a5/zYSbThd
This commit is contained in:
sebastjanartic 2026-01-24 13:32:23 +00:00
parent 666c77aabc
commit 9273288118

View File

@ -143,9 +143,14 @@ app.use((req, res, next) => {
`<meta property="og:title" content="${escapeHtml(video.title)}"`
);
// Truncate description to 150 characters for clean social preview
let shortDescription = video.description || `${video.title} Jetzt ansehen auf video.folx.tv`;
if (shortDescription.length > 150) {
shortDescription = shortDescription.substring(0, 147) + '...';
}
template = template.replace(
/<meta property="og:description" content="[^"]*"/,
`<meta property="og:description" content="${escapeHtml(video.description || `Watch ${video.title} on go4.video`)}"`
`<meta property="og:description" content="${escapeHtml(shortDescription)}"`
);
// Replace og:image - handle both with and without id attribute
@ -173,7 +178,7 @@ app.use((req, res, next) => {
template = template.replace(
/<meta name="twitter:description" content="[^"]*"/,
`<meta name="twitter:description" content="${escapeHtml(video.description || `Watch ${video.title} on go4.video`)}"`
`<meta name="twitter:description" content="${escapeHtml(shortDescription)}"`
);
// Also update URL and secure image tags that have id attributes