Components: Social Share Buttons
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.
Scope
- - Share buttons: Share current page URL to X, LinkedIn, Facebook, WhatsApp, etc.
- Not social profile links (e.g. "Follow us on X") — those live in footer/nav
Why It Matters
- - Websites with visible social share icons tend to see higher social engagement
- Share buttons amplify reach; Open Graph and Twitter Cards control preview — see open-graph, twitter-cards
Placement (Article Pages)
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.
| Placement | Best For | Notes |
|---|
| After first paragraph | Most articles | Catches speed-readers; visible early |
| Sticky sidebar |
Long-form (desktop) | Always visible; consider hiding on mobile |
|
Below title / hero | Short posts | High visibility |
|
End of article | All | Natural completion point; pair with CTA |
|
Mid-article (after key insight) | Long content | Place 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).
Share URLs (Intent Links)
Use platform share/intent URLs so users share with one click:
| Platform | Share URL pattern |
|---|
| X (Twitter) | INLINECODE0 |
| LinkedIn |
https://www.linkedin.com/sharing/share-offsite/?url={url} |
|
Facebook |
https://www.facebook.com/sharer/sharer.php?u={url} |
|
WhatsApp |
https://wa.me/?text={url}%20{text} |
|
Telegram |
https://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.
Platform Brand Guidelines (Icons)
Use official brand assets. Minimum sizes and color rules:
| Platform | Min size | Colors | Notes |
|---|
| Facebook | 16px | Blue #1877F2 or monochrome | No rotation, animation without permission |
| X (Twitter) |
32px | Black or white only | Use current X logo, not deprecated bird |
|
LinkedIn | 21px height | Blue #0A66C2 or monochrome | Use "in" bug for icons |
|
Instagram | 29×29px | Black, white, or official gradient | Glyph for social icons |
Source icons from official brand resource centers. Outdated or non-compliant icons reduce perceived shareability.
Design & Technical
| Item | Guideline |
|---|
| Format | SVG preferred (scalable, small); PNG/WebP with fallback |
| Performance |
Lightweight; avoid heavy share plugins that slow LCP |
|
Accessibility |
aria-label="Share on X"; keyboard accessible |
|
Mobile | Touch targets ≥44×44px; consider native share API (
navigator.share) on mobile |
Native Share API (Mobile)
On supported browsers, navigator.share lets users share via system dialog (includes more apps). Fallback to intent links when unsupported:
CODEBLOCK0
Output Format
- - Placement recommendation for page type
- Platforms to include (3–5)
- Share URL examples with placeholders
- Icon guidelines (size, source)
- Accessibility checklist
Related Skills
- - article-page-generator: Share buttons on article pages; placement after intro, end of article
- blog-page-generator: Share buttons on blog index and post cards
- open-graph: OG tags control share preview (og:image, og:title, etc.) — required for share buttons to show rich cards on Facebook, LinkedIn
- twitter-cards: Twitter Cards control X preview — required for share buttons to show rich cards when shared to X
- footer-generator: Footer has social profile links (Follow us); this skill is for share buttons (share this page)
组件:社交分享按钮
指导如何实现分享按钮,让用户将当前页面(文章、帖子、产品)分享到社交平台。与社交资料链接(指向品牌X、领英等平台的页脚链接)不同——分享按钮分享的是当前内容。
调用时:在首次使用时,如有帮助,可先以1-2句话说明此技能涵盖的内容及其重要性,然后提供主要输出。在后续使用或用户要求跳过时,直接进入主要输出。
范围
- - 分享按钮:将当前页面URL分享到X、领英、脸书、WhatsApp等平台
- 不包含社交资料链接(如在X上关注我们)——这些位于页脚/导航栏
重要性
- - 带有可见社交分享图标的网站往往能获得更高的社交互动
- 分享按钮可扩大传播范围;Open Graph和Twitter卡片控制预览效果——参见open-graph、twitter-cards
放置位置(文章页面)
数量少、位置佳的按钮优于分散放置。 研究显示:移除80%的按钮,将剩余20%重新放置在高情感时刻,可使分享行为的转化率提升3倍。
| 放置位置 | 最适合 | 备注 |
|---|
| 第一段后 | 大多数文章 | 捕捉快速浏览者;早期可见 |
| 固定侧边栏 |
长文(桌面端) | 始终可见;移动端考虑隐藏 |
|
标题/主视觉下方 | 短帖 | 高可见性 |
|
文章末尾 | 所有类型 | 自然结束点;配合行动号召 |
|
文章中间(关键见解后) | 长内容 | 放置在摩擦点(惊人数据后、行动号召前) |
避免:数十个图标;当受众只使用2-3个平台时不要列出所有平台。选择3-5个符合受众的平台(例如B2B:X、领英;B2C:X、脸书、WhatsApp)。
分享URL(意图链接)
使用平台分享/意图链接,让用户一键分享:
| 平台 | 分享URL模式 |
|---|
| X(Twitter) | https://twitter.com/intent/tweet?url={url}&text={text} |
| 领英 |
https://www.linkedin.com/sharing/share-offsite/?url={url} |
|
脸书 | https://www.facebook.com/sharer/sharer.php?u={url} |
|
WhatsApp | https://wa.me/?text={url}%20{text} |
|
Telegram | https://t.me/share/url?url={url}&text={text} |
使用encodeURIComponent()对url和text进行编码。text使用页面标题或简短预写消息——带有预写消息的平台特定提示比通用图标表现好约4倍。
平台品牌指南(图标)
使用官方品牌资源。最小尺寸和颜色规则:
| 平台 | 最小尺寸 | 颜色 | 备注 |
|---|
| 脸书 | 16px | 蓝色 #1877F2 或单色 | 未经许可不得旋转、动画 |
| X(Twitter) |
32px | 仅黑色或白色 | 使用当前X标志,非已弃用的鸟形 |
|
领英 | 高度21px | 蓝色 #0A66C2 或单色 | 图标使用in标记 |
|
Instagram | 29×29px | 黑色、白色或官方渐变 | 社交图标使用字形 |
从官方品牌资源中心获取图标。过时或不合规的图标会降低可分享性感知。
设计与技术
| 项目 | 指南 |
|---|
| 格式 | 首选SVG(可缩放、体积小);带备选的PNG/WebP |
| 性能 |
轻量级;避免影响LCP的繁重分享插件 |
|
无障碍 | aria-label=在X上分享;键盘可访问 |
|
移动端 | 触摸目标≥44×44px;移动端考虑原生分享API(navigator.share) |
原生分享API(移动端)
在支持的浏览器上,navigator.share让用户通过系统对话框分享(包含更多应用)。不支持时回退到意图链接:
javascript
if (navigator.share) {
navigator.share({ title, url, text }).catch(() => {});
} else {
window.open(shareUrl, _blank, noopener);
}
输出格式
- - 放置位置建议(针对页面类型)
- 平台选择(3-5个)
- 分享URL示例(带占位符)
- 图标指南(尺寸、来源)
- 无障碍检查清单
相关技能
- - article-page-generator:文章页面上的分享按钮;放置于引言后、文章末尾
- blog-page-generator:博客首页和帖子卡片上的分享按钮
- open-graph:OG标签控制分享预览(og:image、og:title等)——分享按钮在脸书、领英上显示丰富卡片所必需
- twitter-cards:Twitter卡片控制X预览——分享按钮在分享到X时显示丰富卡片所必需
- footer-generator:页脚包含社交资料链接(关注我们);此技能针对分享按钮(分享此页面)