fix: social buttons

This commit is contained in:
Oleg Proskurin 2026-01-21 20:43:14 +07:00
parent 8b1487e743
commit 348a887e4f
1 changed files with 8 additions and 1 deletions

View File

@ -8,7 +8,14 @@ interface BlogShareButtonsProps {
}
export const BlogShareButtons = ({ url, title }: BlogShareButtonsProps) => {
const shareUrl = url || (typeof window !== 'undefined' ? window.location.href : '');
// Build full URL from relative path
const getFullUrl = () => {
if (typeof window === 'undefined') return url || '';
if (url?.startsWith('http')) return url;
return `${window.location.origin}${url || window.location.pathname}`;
};
const shareUrl = getFullUrl();
const shareTitle = title || '';
const handleCopyLink = async () => {