标题不仅关乎搜索引擎优化(SEO),也关乎无障碍访问(accessibility)。
屏幕阅读器可以从一个标题跳到另一个标题,我们可以用键盘快捷键指定标题深度。
主题有其 <h1> 标题,但每个回复前都会加上其自己隐藏的 <h2>,屏幕阅读器可以将其显示出来:
<h2 aria-hidden="false" class="sr-only" id="post-heading-9">
post by Jagster 4 hours ago
</h2>
因此,在任何情况下,当你在内容中发布 <h1> 或 <h2> 标题时,它都将是预先存在的 <h2> 的后代元素 ![]()
我认为,在帖子中使用高于 <h3> 的标题可能会使屏幕阅读器的导航变得有点奇怪。
虽然现有主题之间并不完全一致,但来自 Customization > Plugin 的帖子模板使用 <h3> 作为顶级标题:
| | | |
| - | - | - |
| :information_source: | **Summary** | In a few words, what does this plugin do? |
| :hammer_and_wrench: | **Repository Link** | <> |
| :open_book: | **Install Guide** | [How to install plugins in Discourse](https://meta.discourse.org/t/install-plugins-in-discourse/19157) |
<br>
### Features
Describe the major features of the plugin
### Configuration
Include detailed steps on how to configure the plugin (include screenshots where necessary)
### Settings
Include a table of settings and setting descriptions
| Name | Description
|-|-|
|
有趣的是,Customization > Theme 和 Customization > Theme component 模板的情况并非如此,但它们的模板不包含任何标题。也许应该改变这一点。