File: /var/www/quadcode.com/src/utils/shareLinks.ts
/** Build third-party share URLs and mailto with encoded query parts. */
export function buildShareLinks(pageUrl: string, title: string) {
const encUrl = encodeURIComponent(pageUrl);
const encTitle = encodeURIComponent(title);
const mailBody = encodeURIComponent(`${title}\n\n${pageUrl}`);
return {
linkedIn: `https://www.linkedin.com/sharing/share-offsite/?url=${encUrl}`,
x: `https://twitter.com/intent/tweet?url=${encUrl}&text=${encTitle}`,
facebook: `https://www.facebook.com/sharer/sharer.php?u=${encUrl}`,
mailto: `mailto:?subject=${encTitle}&body=${mailBody}`,
};
}