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) => (