fix: social buttons
This commit is contained in:
parent
8b1487e743
commit
348a887e4f
|
|
@ -8,7 +8,14 @@ interface BlogShareButtonsProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BlogShareButtons = ({ url, title }: 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 shareTitle = title || '';
|
||||||
|
|
||||||
const handleCopyLink = async () => {
|
const handleCopyLink = async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue