In the past I have often put the site title in an tag, and then the main page title in an . Is this considered correct, or should the main page title be in the tag? If so, where do you put the site title? In a regular
? Or?
在过去,我经常将网站标题放在
标签中,然后将主页标题放在
中。这被认为是正确的,还是主页标题应该在
标签中?如果是这样,你在哪里放置网站标题?在常规
?要么?
What is the most semantically correct, and what is the best when considering things like accessibility?
什么是最语义正确的,在考虑可访问性等问题时最好的是什么?
3 个解决方案
#1
6
There's no real standard and there are quite a few differing opinions. I agree with womp though: you shouldn't have the same H1 on every page of the site. I'd leave the site title to the
Semantically (and to aid accessibility), the generally accepted rule is one per page or topic. It's valid to have more than one top-level heading on a page, as long as those headings break the document into separate logical chunks discussing different things. So to take the example of a blog home page showing the five most recent articles, it would be fine for each to have its own .
However, when it comes to SEO, the recommendations are usually that you only have one H1 per page.
但是,当涉及到SEO时,建议通常是每页只有一个H1。
I've gone for a hybrid approach on my design blog: on the home page, there is an H1 describing the site, and each post title is an . However, on the individual post pages, the post title is the . This seems (so far) to strike a good balance between semantics and optimising for search engines.
我在设计博客上采用了混合方法:在主页上有一个描述网站的H1,每个帖子标题都是
。但是,在各个帖子页面上,帖子标题是
。这似乎(到目前为止)在语义和搜索引擎优化之间取得了良好的平衡。
#2
5
It's better if H1 tags are contextually related to the majority of the content on the page - so it should really be the page title.
如果H1标签与页面上的大部分内容在上下文中相关,那就更好了 - 所以它应该是页面标题。
If every page has the same H1 tag (i.e. the site title), it degrades the value of them (and overall, they are really the most valuable tag).