标题级别的最佳实践

Best practice for heading levels

我有一组页面,其中一个页面有子类别,另一个页面没有。构建标题的最佳方式是什么?每个具有相同重要性的项目是否应该具有相同的标题级别,即使这意味着跳过 h2,例如?这条路线肯定让 CSS 更容易。

第一页:

<h1>Dogs</h1>
<h2>Small Dogs</h2>
<h3>Chihuahua</h3>
<h3>Jack Russell Terrier</h3>
<h2>Big Dogs</h2>
<h3>Greyhound</h3>
<h3>Golden Retriever</h3>

第二页:

<h1>Cats</h1>
<h3>American Shorthair</h3>
<h3>Siamese</h3>
<h3>Manx</h3>

(也假定每个h3下的实际内容,ofc。)

或者狗的品种应该是h2,猫的品种应该是h3?或者本例中的每个品种都应该是 h2,而不是将 "Small Dogs" 和 "Big Dogs" 标记为标题吗?或者其他选择?

主要取决于developer/designer您想如何做事。关于标题的一般概念是

The most important tag is the h1 heading tag, and will usually be the title of a post.And the sub headings go to the h2 tag and the order goes so on.

我提到的这些东西是基于对SEO(搜索引擎优化)的重视。通常一个页面应该只包含一个 h1 标签,而可能有多个 h2 标签。
现在为了简化事情,最主要的是你想做什么。实现的最佳方法是更多地使用 h2 和 h3 并使用 class 来提供正确的样式。但请记住不要在页面中多次使用 h1 标签。按照SEO一般方式

The h1 tag should contain your targeted keywords, ones that closely relate to the page title and are relevant to your content. The h2 tag is a subheading and should contain similar keywords to your h1 tag. Your h3 is then a subheading for your h2 and so on. Think of them as a hierarchy based on importance, the above being more important than the below.

主要是您认为这些列表的偏好顺序是什么。哪个更重要,哪个更不重要。在 h3 标签之后,它们通常无关紧要,所以使用 classes 并设置它们的样式。

我们应该始终使用带有主要关键字的 h1 标签。 H1 标签应该只使用一个。 然后我们可以在关键字中使用 H2。应用作副标题。

然后是h3和h4。