Improve social media image and URL generation for better sharing

Update social media image URL to use cache-busting with current timestamp and prioritize Bunny.net thumbnail.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1/HCAS0JG
This commit is contained in:
sebastjanartic 2025-09-03 10:59:42 +00:00
parent 169b4b777b
commit 49fbc393a6
2 changed files with 7 additions and 3 deletions

View File

@ -119,7 +119,7 @@
<script>
// Set dynamic URLs based on current domain
const currentOrigin = window.location.origin;
const socialImageUrl = `${currentOrigin}/api/social-image?v=2025`;
const socialImageUrl = `${currentOrigin}/api/social-image?v=${Date.now()}`;
// Update meta tags with correct URLs
document.getElementById('og-url').setAttribute('content', currentOrigin + '/');

View File

@ -180,10 +180,14 @@ export default function VideoPage() {
: `${currentVideo.title} - Professionelle Video-Streaming-Plattform mit exklusivem Content von FOLX STADL, Geschichte des Liedes und weiteren Premium-Inhalten auf go4.video.`;
updateMetaTag('og:description', richDescription);
// Get the correct domain dynamically and add cache-busting
// For social media, use direct Bunny.net thumbnail if available, otherwise fallback to our endpoint
const timestamp = new Date().getTime();
const currentDomain = window.location.origin;
const socialThumbnail = `${currentDomain}/api/video-thumbnail/${currentVideo.id}?v=${timestamp}`;
// Use original Bunny thumbnail with cache-busting for social media
const socialThumbnail = currentVideo.thumbnailUrl
? `${currentVideo.thumbnailUrl}?t=${timestamp}`
: `${currentDomain}/api/video-thumbnail/${currentVideo.id}?v=${timestamp}`;
updateMetaTag('og:image', socialThumbnail);
updateMetaTag('og:image:width', '1200');
updateMetaTag('og:image:height', '630');