fix: ssr error
This commit is contained in:
parent
348a887e4f
commit
ed9c54da1d
|
|
@ -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 () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue