--- export interface Props { /** Page URL (defaults to current page) */ url?: string; /** Page title */ title?: string; } const { url, title } = Astro.props; const pageUrl = url ?? Astro.url.href; const pageTitle = title ?? ""; const encodedUrl = encodeURIComponent(pageUrl); const encodedTitle = encodeURIComponent(pageTitle); const siteCredits = encodeURIComponent("小平市議 安竹洋平"); const xText = encodedTitle ? `${encodedTitle}%20%7C%20${siteCredits}` : siteCredits; const SHARE_LINKS = [ { label: "X", href: `https://x.com/intent/tweet?url=${encodedUrl}&text=${xText}`, svg: '', }, { label: "Facebook", href: `https://www.facebook.com/sharer/sharer.php?u=${encodedUrl}`, svg: '', }, { label: "URLコピー", href: "#", svg: '', }, ]; ---
このページを共有: {SHARE_LINKS.map((link) => ( {link.label} ))}