fix: ssr error

This commit is contained in:
Oleg Proskurin 2026-01-21 20:48:13 +07:00
parent 348a887e4f
commit ed9c54da1d
1 changed files with 3 additions and 8 deletions

View File

@ -7,15 +7,10 @@ interface BlogShareButtonsProps {
title?: string; title?: string;
} }
export const BlogShareButtons = ({ url, title }: BlogShareButtonsProps) => { const BASE_URL = 'https://banatie.app';
// 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(); export const BlogShareButtons = ({ url, title }: BlogShareButtonsProps) => {
const shareUrl = url ? `${BASE_URL}${url}` : BASE_URL;
const shareTitle = title || ''; const shareTitle = title || '';
const handleCopyLink = async () => { const handleCopyLink = async () => {