大网数据广告活动
网站运营与故障问答

Same text for <h1> and <h2>

· 52CE 我爱测

What do you think about having the same content for H1 and H2 tag in the article? It seems like keyword stuffing, right? Example: <h1>Bananas <span>Musa × paradisiaca</span></h1> <h2>Bananas <span>Musa × paradisiaca</span></h2> <…

问题原文

原帖链接 · Boris Kozarac · CC BY-SA 3.0

What do you think about having the same content for H1 and H2 tag in the article? It seems like keyword stuffing, right? Example:

<h1>Bananas <span>Musa × paradisiaca</span></h1>

<h2>Bananas <span>Musa × paradisiaca</span></h2>

<h2>Description</h2>  
<p>Bananas are long and yellow. Bananas are long and yellow.</p>

<h2>Taste</h2>  
<p>Bananas are delicious. Bananas are delicious. Bananas are delicious.</p>

Do you think this is a bad practice? This is how graphic layout is made for a page so the title should repeat itself (there is a tall image between them), and I'm wondering if it would be better to have markup something like this (in this case <p>), but styled as so it looks like h2.

Would you suggest something else instead of <p> which better suits a title consisted of a 2-3 words? This is a purely design based idea and I wouldn't even mind telling search engines to not index this line.

<h1>Bananas <span>Musa × paradisiaca</span></h1>

<p class="h2">Bananas <span>Musa × paradisiaca</span></p>

<h2>Description</h2>  
<p>Bananas are long and yellow. Bananas are long and yellow.</p>

<h2>Taste</h2>  
<p>Bananas are delicious. Bananas are delicious. Bananas are delicious.</p>

(Span has a display: block set so that it goes to next line)

已采纳解答

原帖链接 · unor · CC BY-SA 3.0

Don’t use another heading element for the duplicated content. Headings (h1-h6) serve various purposes (generating the document outline, navigation for screen reader users, etc.). A duplicated heading is useless and can be bothersome or lead to confusion.

Using a different element and styling it according to your intended design is the correct way. Using p for this seems to be appropriate; otherwise the meaningless div.

To make clear that this text is not part of the section’s main content, you could use the header element to group the heading, the duplicated heading text, and the image (assuming that the image is also part of the header).

To make clear that the duplicated text is not relevant, and only serves an aesthetic purpose, you can use the WAI-ARIA presentation role.

So your section would contain:

<header>
  <h1>Bananas <span>Musa × paradisiaca</span></h1>
  <img src="tall-image.png" alt="" />
  <p role="presentation">Bananas <span>Musa × paradisiaca</span></p>
</header>

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-06-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。