考虑到 SEO ,语义和文档大纲,哪些标记对于网站标题是正确的(或最常用的)其他次要部分的标题(例如侧栏,相关链接)?
示例文件:
<header>
<h1>I'm Site Name, not the title of actual article</h1>
</header>
<aside>
<h1>And I'm sidebar heading, ain't about the article of this page either</h1>
</aside>
<article>
<h1>I'm the title of article, supposed to be what this page is all about</h1>
<p>intro...<p>
<h2>Subhead. Make site name and section heading a h2 tag, and I'm equal to them.</h2>
<p>text of about the subhead...</p>
</article>
这些是我想到的3条指导原则:
准则1:没人做的方式
strong
标记网站标题和部分标题。准则2:网站标题=文章的子主题
h2
标记;和h3
标题上的标题准则3:只使用一种标题标记
答案 0 :(得分:0)
您可以为每个部分使用h1
(例如在示例代码段中),也可以使用相应等级的标题元素(对应于部分的嵌套级别)。
两种方式都有pros and cons,但HTML5规范鼓励作者使用后一种方式(probably because of old or non-conforming user agents)。
根据该建议,您的代码段将是:
<header>
<h1>Site name</h1>
</header>
<aside>
<h2>Aside title</h2>
</aside>
<article>
<h2>Article title</h2>
<section>
<h3>Subhead</h3>
</section>
</article>
请注意,我为“Subhead”标题启动的隐式部分添加了section
元素。这是encouraged by HTML5, too。
答案 1 :(得分:0)
经过更多研究(以及某种验证),我已经找到了一个适当的解决方案(我希望)意味着对SEO重要性的层次结构。
对于文章页面
主页
修改强> 我同意明确使用每个子主题的部分为@ unor&#39; s answered。
答案 2 :(得分:-1)
您这样做是正确的,但每个页面上只应包含一个标记,并在其中包含最重要的关键字。