当用户想要添加、优化或审核社交分享按钮(分享文章到X、LinkedIn、Facebook等)时使用。当用户提到“分享按钮”等相关内容时也使用。
Guides implementation of share buttons that let users share the current page (article, post, product) to social platforms. Distinct from social profile links (footer links to your brand's X, LinkedIn, etc.) — share buttons share this content.
When invoking: On first use, if helpful, open with 1–2 sentences on what this skill covers and why it matters, then provide the main output. On subsequent use or when the user asks to skip, go directly to the main output.
Fewer, better-placed buttons outperform scattered placement. Research: removing 80% of buttons and repositioning the remaining 20% at high-emotion moments can 3× conversion on share actions.
PlacementBest ForNotesAfter first paragraphMost articlesCatches speed-readers; visible earlySticky sidebarLong-form (desktop)Always visible; consider hiding on mobileBelow title / heroShort postsHigh visibilityEnd of articleAllNatural completion point; pair with CTAMid-article (after key insight)Long contentPlace at friction points (after surprising stat, before CTA)
Avoid: Dozens of icons; every platform when audience uses 2–3. Choose 3–5 platforms that match your audience (e.g. B2B: X, LinkedIn; B2C: X, Facebook, WhatsApp).
Use platform share/intent URLs so users share with one click:
PlatformShare URL patternX (Twitter)https://twitter.com/intent/tweet?url={url}&text={text}LinkedInhttps://www.linkedin.com/sharing/share-offsite/?url={url}Facebookhttps://www.facebook.com/sharer/sharer.php?u={url}WhatsApphttps://wa.me/?text={url}%20{text}Telegramhttps://t.me/share/url?url={url}&text={text}
Encode url and text with encodeURIComponent(). Use page title or a short pre-written message for text — platform-specific prompts with pre-written messages perform ~4× better than generic icons.
Use official brand assets. Minimum sizes and color rules:
PlatformMin sizeColorsNotesFacebook16pxBlue #1877F2 or monochromeNo rotation, animation without permissionX (Twitter)32pxBlack or white onlyUse current X logo, not deprecated birdLinkedIn21px heightBlue #0A66C2 or monochromeUse "in" bug for iconsInstagram29×29pxBlack, white, or official gradientGlyph for social icons
Source icons from official brand resource centers. Outdated or non-compliant icons reduce perceived shareability.
ItemGuidelineFormatSVG preferred (scalable, small); PNG/WebP with fallbackPerformanceLightweight; avoid heavy share plugins that slow LCPAccessibilityaria-label="Share on X"; keyboard accessibleMobileTouch targets ≥44×44px; consider native share API ( navigator.share) on mobile
On supported browsers, navigator.share lets users share via system dialog (includes more apps). Fallback to intent links when unsupported:
javascript
if (navigator.share) {
navigator.share({ title, url, text }).catch(() => {});
} else {
window.open(shareUrl, '_blank', 'noopener');
}