From 75448201535b7d7f35cea5dec8da733ad347cddd Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Thu, 5 Mar 2026 14:32:31 +0000 Subject: [PATCH] Ensure social sharing links use the correct domain Update share buttons and copy link functionality to consistently use the canonical domain (https://www.folx.tv) for all generated URLs, resolving issues with social media scraping and display. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1f7e7e89-a520-4970-9645-37daadc466dc Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 0050f02e-3b94-4ac8-92d6-d75766bae769 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/1f7e7e89-a520-4970-9645-37daadc466dc/ZApZ5Qi Replit-Helium-Checkpoint-Created: true --- client/src/components/share-buttons.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/client/src/components/share-buttons.tsx b/client/src/components/share-buttons.tsx index f8c5e11..0ff2f62 100644 --- a/client/src/components/share-buttons.tsx +++ b/client/src/components/share-buttons.tsx @@ -8,6 +8,17 @@ interface ShareButtonsProps { image?: string; } +const CANONICAL_DOMAIN = "https://www.folx.tv"; + +function canonicalUrl(url: string): string { + try { + const parsed = new URL(url); + return `${CANONICAL_DOMAIN}${parsed.pathname}${parsed.search}${parsed.hash}`; + } catch { + return url; + } +} + const SHARE_TARGETS = [ { name: "Facebook", @@ -58,12 +69,12 @@ export default function ShareButtons({ url, title, image }: ShareButtonsProps) { const handleCopy = async () => { try { - await navigator.clipboard.writeText(url); + await navigator.clipboard.writeText(canonicalUrl(url)); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch { const input = document.createElement("input"); - input.value = url; + input.value = canonicalUrl(url); document.body.appendChild(input); input.select(); document.execCommand("copy"); @@ -79,7 +90,7 @@ export default function ShareButtons({ url, title, image }: ShareButtonsProps) { {SHARE_TARGETS.map((target) => (