tab-accordion by kostja94/marketing-skills
npx skills add https://github.com/kostja94/marketing-skills --skill tab-accordion指导标签页和手风琴的实现,用于组织内容而无需占用过多垂直空间。两种布局模式:垂直手风琴(常见于FAQ,垂直堆叠)和水平标签页(常见于操作指南,并排显示)。两者都能通过减少滚动来提升用户体验;对SEO的影响取决于实现方式和内容放置。
调用时:在首次使用时,如果合适,先用1-2句话说明此技能涵盖的内容及其重要性,然后提供主要输出。在后续使用或用户要求跳过时,直接提供主要输出。
| 模式 | 布局 | 最适合 | 示例 |
|---|---|---|---|
| 垂直手风琴 | 垂直堆叠;一次展开/折叠一个 | FAQ、问答、长列表、异议处理 | "如何退货?" → 下方显示答案 |
| 水平标签页 | 并排标签;一次显示一个面板 | 操作步骤、产品规格、定价方案、对比 | "步骤 1 |
移动端:垂直手风琴在小屏幕上效果良好(符合自然滚动习惯)。水平标签页可能显得拥挤——可以考虑使用手风琴、下拉菜单或可滚动的全宽标签栏。
谷歌的立场:谷歌会完全索引和排名标签页和手风琴内的内容;隐藏内容会获得完整的权重(自2016年移动优先索引以来已确认)。Gary Illyes表示:"我们会索引内容,其权重在排名中被完全考虑。"
实际细微差别:一些测试表明,始终可见的内容在排名上优于隐藏内容。将标签页/手风琴用于次要内容;将主要的、关键词关键内容放在可见区域。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 内容类型 | 放置位置 |
|---|---|
| 主要 / 关注排名 | 首屏可见区域;不隐藏 |
| 次要 / 辅助 | 可使用标签页、手风琴 |
| FAQ答案 | 可使用手风琴;默认展开第一项;参见 faq-page-generator |
内容必须在页面加载时存在于DOM中。 谷歌不会模拟用户点击;它无法"点击"标签页来发现内容。
| 实现方式 | 是否被索引? |
|---|---|
| 所有标签页内容在加载时就在HTML中 | ✅ 是 |
| 点击标签页时通过AJAX加载内容 | ❌ 否 |
建议:在初始HTML中服务器端渲染所有标签页内容;仅使用CSS/JS来显示/隐藏。优先使用 <details>/<summary> 或等效的服务器端渲染标记。关于SSR、SSG、CSR和爬虫可见性,请参见 rendering-strategies。
技术上:是的——如果所有内容在加载时都在DOM中,更多标签页 = 更多可索引内容。移动优先索引会给予HTML中标签页内容完整的权重。
策略上:并非总是如此。当许多标签页 = 一个页面上有许多不同主题时,会发生信号稀释。谷歌可能难以理解页面应该针对哪个查询进行排名;主题权威性和关键词焦点会被分散。
| 场景 | 使用标签页? | 替代方案 |
|---|---|---|
| 相同主题(操作指南步骤1/2/3;产品规格:尺寸、材料、运输) | ✅ 是 | — |
| 不同主题(服务A、服务B、作品集、博客) | ❌ 否 | 每个主题使用独立的URL;关于支柱/集群,请参见 content-strategy |
何时适合使用多个水平标签页:所有标签页在语义上都与一个查询相关(例如,一个操作指南、一个产品)。何时使用独立页面:每个标签页都是一个不同的主题,值得拥有自己的URL、抓取和排名机会。
使用 <details> 和 <summary>——无需JavaScript;可访问;可抓取。
<details open>
<summary>第一个问题(默认展开)</summary>
<p>答案内容在此。</p>
</details>
<details>
<summary>第二个问题</summary>
<p>答案内容在此。</p>
</details>
open 属性,使其默认展开<summary>:必须是 <details> 的第一个子元素;充当切换开关如果使用纯JS标签页:确保所有标签页内容在页面加载时就在DOM中,而不是点击时通过AJAX加载。谷歌不会模拟标签点击。优先使用 <details>/<summary> 或服务器端渲染的HTML。参见 rendering-strategies。
display: none 或 visibility: hidden——谷歌可能区别对待| 实践 | 目的 |
|---|---|
| 第一项默认展开 | 确保主要内容在加载时可见;对SEO和UX更好 |
| 描述性标题 | <summary> / 标签页标签应清晰描述内容;自然地包含关键词 |
| 逻辑结构 | 使用H2/H3作为章节标题;支持片段提取;参见 featured-snippet |
| 答案优先 | 对于FAQ:40–60字的直接答案;然后是细节;参见 faq-page-generator |
| 使用案例 | 格式 | 布局 | 备注 |
|---|---|---|---|
| FAQ | 手风琴 | 垂直 | FAQPage结构化数据;第一个问题展开;参见 faq-page-generator |
| 操作指南步骤 | 标签页 | 水平 | 步骤1、步骤2、步骤3;顺序流程 |
| 产品规格 | 标签页 | 水平 | 尺寸、材料、运输——次于主内容区 |
| 长篇指南 | 手风琴 | 垂直 | 可折叠章节;参见 toc-generator |
| 定价方案 | 标签页 | 水平 | 比较计划;主要CTA可见 |
| 异议处理 | 手风琴 | 垂直 | "关于X怎么办?"——辅助转化 |
<details>/<summary> 原生支持键盘访问<details>/<summary> 或等效的服务器端渲染HTML每周安装量
175
代码仓库
GitHub Stars
239
首次出现
Mar 6, 2026
安全审计
安装于
cursor158
gemini-cli157
kimi-cli157
codex157
opencode157
github-copilot157
Guides tab and accordion implementation for organizing content without excessive vertical space. Two layout patterns: vertical accordion (FAQ-style, stacked) and horizontal tabs (how-to style, side-by-side). Both improve UX by reducing scroll; SEO impact depends on implementation and content placement.
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.
| Pattern | Layout | Best for | Example |
|---|---|---|---|
| Vertical accordion | Stacked; expand/collapse one at a time | FAQ, Q&A, long lists, objection handling | "How do I return?" → answer below |
| Horizontal tabs | Side-by-side labels; one panel visible | How-to steps, product specs, pricing tiers, comparisons | "Step 1 |
Mobile : Vertical accordion works well on small screens (natural scroll). Horizontal tabs can feel cramped—consider accordion, dropdown, or full-width tab bar that scrolls.
Google's position : Google indexes and ranks content inside tabs and accordions fully; hidden content receives full weight (confirmed since 2016 mobile-first indexing). Gary Illyes: "we index the content, its weight is fully considered for ranking."
Practical nuance : Some tests show always-visible content outperforms hidden content in rankings. Reserve tabs/accordions for secondary content; place primary, keyword-critical content in visible areas.
| Content type | Placement |
|---|---|
| Primary / ranking-focused | Visible above fold; not hidden |
| Secondary / supporting | Tabs, accordions acceptable |
| FAQ answers | Accordion OK; first item expanded by default; see faq-page-generator |
Content must be in the DOM on page load. Google does not simulate user clicks; it cannot "click" tabs to discover content.
| Implementation | Indexed? |
|---|---|
| All tab content in HTML at load | ✅ Yes |
| Content loaded via AJAX on tab click | ❌ No |
Recommendation : Server-render all tab content in the initial HTML; use CSS/JS only to show/hide. Prefer <details>/<summary> or equivalent server-rendered markup. See rendering-strategies for SSR, SSG, CSR and crawler visibility.
Technically : Yes—if all content is in the DOM at load, more tabs = more indexable content. Mobile-first indexing gives full weight to tabbed content in HTML.
Strategically : Not always. Signal dilution occurs when many tabs = many different topics on one page. Google may struggle to understand which query the page should rank for; topical authority and keyword focus get spread thin.
| Scenario | Use tabs? | Alternative |
|---|---|---|
| Same topic (How-to Step 1/2/3; product specs: dimensions, materials, shipping) | ✅ Yes | — |
| Different topics (Service A, Service B, Portfolio, Blog) | ❌ No | Separate URLs per topic; see content-strategy for pillar/cluster |
When many horizontal tabs work : All tabs semantically related to one query (e.g., one how-to, one product). When to use separate pages : Each tab is a distinct topic deserving its own URL, crawl, and ranking opportunity.
Use <details> and <summary>—no JavaScript required; accessible; crawlable.
<details open>
<summary>First question (expanded by default)</summary>
<p>Answer content here.</p>
</details>
<details>
<summary>Second question</summary>
<p>Answer content here.</p>
</details>
open attribute so it's expanded by default<summary>: Must be first child of <details>; acts as toggleIf using JS-only tabs: ensure all tab content is in the DOM at page load , not loaded via AJAX on click. Google does not simulate tab clicks. Prefer <details>/<summary> or server-rendered HTML. See rendering-strategies.
display: none or visibility: hidden for primary content—Google may treat differently| Practice | Purpose |
|---|---|
| First item expanded | Ensures primary content visible on load; better for SEO and UX |
| Descriptive headers | <summary> / tab labels should clearly describe content; include keywords naturally |
| Logical structure | H2/H3 for sections; supports snippet extraction; see featured-snippet |
| Answer-first | For FAQ: 40–60 words direct answer; then detail; see faq-page-generator |
| Use case | Format | Layout | Notes |
|---|---|---|---|
| FAQ | Accordion | Vertical | FAQPage schema; first Q expanded; see faq-page-generator |
| How-to steps | Tabs | Horizontal | Step 1, Step 2, Step 3; sequential flow |
| Product specs | Tabs | Horizontal | Dimensions, materials, shipping—secondary to hero |
| Long guides | Accordion | Vertical | Collapsible sections; see toc-generator |
| Pricing tiers | Tabs | Horizontal | Compare plans; primary CTA visible |
| Objection handling |
<details>/<summary> natively keyboard-accessible<details>/<summary> or equivalent server-rendered HTMLWeekly Installs
175
Repository
GitHub Stars
239
First Seen
Mar 6, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
cursor158
gemini-cli157
kimi-cli157
codex157
opencode157
github-copilot157
程序化SEO实战指南:大规模创建优质页面,避免内容单薄惩罚
39,700 周安装
| Accordion |
| Vertical |
| "What about X?"—supporting conversion |