# Disable headers in replies like \<h1\> and \<h2\>

**URL:** https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775
**Category:** Support
**Created:** [28 februari 2018 om 13:44 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775 "2018-02-28T13:44:22Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![erikmolenaarnl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erikmolenaarnl/32/76132_2.png) [@erikmolenaarnl](https://meta.discourse.org/u/erikmolenaarnl)
#### Post date: [28 februari 2018 om 13:44 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/1 "2018-02-28T13:44:22Z")

</div>

Hi,

I like the fact that Discourse allows me to set **strong** or _italic_ text styles in replies.

What I don’t like is that it allows headers. It’s bad for readability, SEO and confuses spiders:

# H1 header

## H2 header

Or check out this real live example: [Welcome - TechSmith Screencast](https://www.screencast.com/t/BTyGodbB1)

So: is it possible to disable headers; so they get ignored like below example at Wordpress .org?

 ![2018-02-28_14-39-27](https://global.discourse-cdn.com/meta/original/3X/4/4/44824415f92a1b556f807972a88fa87f934236e8.jpg)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [28 februari 2018 om 14:12 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/2 "2018-02-28T14:12:25Z")

</div>

I think that headers are very useful and that people should use them more. That said, I think I agree that h1 an h2 headers don’t make sense in posts, whether they confuse spiders is beyond my scope of expertise.

It does make sense to me that the first level of header in a post should be an h3, so something that converted header\_level+2 automatically would be a good idea.

---

<div class="post-metadata">

### Author: ![erikmolenaarnl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erikmolenaarnl/32/76132_2.png) [@erikmolenaarnl](https://meta.discourse.org/u/erikmolenaarnl)
#### Post date: [28 februari 2018 om 14:27 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/3 "2018-02-28T14:27:33Z")

</div>

> [@pfaffman](#):
>
> whether they confuse spiders is beyond my scope of expertise.

Hi @pfaffman, the problem lies in the fact that users can accidently or mis-use headers and this confuses spiders when they scan the global contents of a page by checking headers (h1 and h2). Especcialy when you use the Wordpress plugin which shows replies below a Wordpress post. It can get very confusing for Googlebot when there are multiple headers on a page.

---

<div class="post-metadata">

### Author: ![erikmolenaarnl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erikmolenaarnl/32/76132_2.png) [@erikmolenaarnl](https://meta.discourse.org/u/erikmolenaarnl)
#### Post date: [28 februari 2018 om 14:29 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/4 "2018-02-28T14:29:16Z")

</div>

I found out Discourse also sets headers when:

## you use a - symbol below a paragraph like this.

# you add a # symbol before a paragraph like this

These headers confuse spiders like Googlebot. I hope this can be disabled soon in Discourse!

---

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [28 februari 2018 om 14:48 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/5 "2018-02-28T14:48:13Z")

</div>

I can’t speak to the Google confusion, though it sounds odd to me that Google would have an issue with headers on a webpage.

Do you have an issue with users abusing headers? I can’t say I’ve seen an issue with this on any of the sites I frequent.

---

<div class="post-metadata">

### Author: ![erikmolenaarnl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erikmolenaarnl/32/76132_2.png) [@erikmolenaarnl](https://meta.discourse.org/u/erikmolenaarnl)
#### Post date: [28 februari 2018 om 14:53 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/6 "2018-02-28T14:53:01Z")

</div>

Check out: [The Definitive Guide to HTML Headings for SEO (H1-H2-H3-H4-H5-H6)](https://www.hobo-web.co.uk/headers/)

I think this is why other forums like [Wordpress.org](http://Wordpress.org) disable usage of headers. I run a technical forum with Discourse where symbols like # and - are used a lot and thus results in undesired header formats.

_ **QUOTE**  **:** ‘ **We do use H tags** to understand the structure of the text on a page better, John Mueller, Google_

**QUOTE** _ **: “** Google looks at a lot of different things … even **things that are like really highlighted like h1 tags** and stuff like that.”_ Matt Cutts, Google

---

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [28 februari 2018 om 14:57 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/7 "2018-02-28T14:57:20Z")

</div>

Skimming that article makes me think it’s a great thing to be using H tags and you should do it more.

> [@erikmolenaarnl](#):
>
> I run a technical forum with Discourse where symbols like # and - are used a lot and thus results in undesired header formats.

This sounds like the actual problem here. Maybe a plugin to disable those pieces of Markdown on your site would make more sense? It would be a hard sell to make this a core change.

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [28 februari 2018 om 15:07 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/8 "2018-02-28T15:07:42Z")

</div>

My understanding of it has always been that headings are contextual based on the sectioned content. So for example, a post contained within an `article` tag should restart heading prioritization from H1.

From [HTML Standard](https://html.spec.whatwg.org/multipage/sections.html#headings-and-sections)

> The first element of [heading content](https://html.spec.whatwg.org/multipage/dom.html#heading-content-2) in an element of [sectioning content](https://html.spec.whatwg.org/multipage/dom.html#sectioning-content-2) [represents](https://html.spec.whatwg.org/multipage/dom.html#represents) the heading for that section. Subsequent headings of equal or higher [rank](https://html.spec.whatwg.org/multipage/sections.html#rank) start new (implied) sections, headings of lower [rank](https://html.spec.whatwg.org/multipage/sections.html#rank) start implied subsections that are part of the previous one. In both cases, the element [represents](https://html.spec.whatwg.org/multipage/dom.html#represents) the heading of the implied section.

I’d be surprised if Google didn’t account for this. Is there any evidence we can see that SEO has been confused by this?

---

<div class="post-metadata">

### Author: ![erikmolenaarnl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erikmolenaarnl/32/76132_2.png) [@erikmolenaarnl](https://meta.discourse.org/u/erikmolenaarnl)
#### Post date: [28 februari 2018 om 15:15 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/9 "2018-02-28T15:15:59Z")

</div>

Hi @awesomerobot

Correct. And Discourse users can mis-use headers when they (accidently) use # and - symbols in their replies and thus:

# Worsen readability

## Confuse spiders like Googlebot with a header like this

**In a SEO optimized environment, forum users should not influence headers usuage**. It’s something only a page admin should apply. I think this is why forums like Wordpress. org do not output headers at all, even when HTML codes like h1 is used.

Take a look at a real-life example of my technical Discourse forum where these characters are used regulary: [Welcome - TechSmith Screencast](https://www.screencast.com/t/BTyGodbB1)

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [28 februari 2018 om 15:58 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/10 "2018-02-28T15:58:32Z")

</div>

For readability you could add some custom CSS to disable formatting. You could even disable it for everyone who’s not in a specific group, for example:

```SCSS
.topic-post:not(.group-team) .cooked {
    H1,H2,H3,H4,H5,H6 {
        font-size: 1em;
        font-weight: normal;
    }
}

```

I don’t think it’s a bad idea to potentially restrict heading use to specific users, but there’s no feature planned to support that at the moment. We wouldn’t want to remove headings entirely for everyone using Discourse, because I believe removing Hs might hurt a community’s search-ability (for example: we have a lot of tutorials here that use headings appropriately… and many aren’t written by staff/admins…).

One thing you could do is add the `#` to the blocked words feature using a regex like `#{1,}\s` (I believe this would work, but I’m not amazing at regex). That would block all `# ` with a space after them (markdown headings).

Of course, that only works on new content. For old content, maybe you can strip out `#` using a rake task?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [28 februari 2018 om 16:13 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/11 "2018-02-28T16:13:35Z")

</div>

> [@erikmolenaarnl](#):
>
> users can accidently or mis-use headers and this confuses spiders when they scan the global contents of a page by checking headers (h1 and h2).

Right. And, besides, h1 and h2 headers just look bad in a post.

> [@joebuhlig](#):
>
> I can’t speak to the Google confusion, though it sounds odd to me that Google would have an issue with headers on a webpage.

I don’t pretend to know anything about SSO (but [Redirecting…](https://www.literatecomputing.com/product/discourse-install/) has crept onto the first page for “discourse install”–but not “install discourse”). It does make sense that spiders would treat H1 headers as if they should be H1 headers and that there shouldn’t be one of them.

> [@erikmolenaarnl](#):
>
> I run a technical forum with Discourse where symbols like # and - are used a lot and thus results in undesired header formats.

If it’s a technical forum those people should be able to learn markdown.

I never use `#` or `##` in a post because it looks bad. I think it’d make sense to either demote H1 and H2 within a post to H3 or to demote all headers by 1 or 2 levels.

---

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [28 februari 2018 om 16:20 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/12 "2018-02-28T16:20:57Z")

</div>

Keep in mind that there are some cases where H tags within posts make perfect sense.

In your case, @erikmolenaarnl, I would potentially write a plugin that edits the post text before it gets to the preview and cooks.

---

<div class="post-metadata">

### Author: ![erikmolenaarnl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erikmolenaarnl/32/76132_2.png) [@erikmolenaarnl](https://meta.discourse.org/u/erikmolenaarnl)
#### Post date: [28 februari 2018 om 19:31 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/13 "2018-02-28T19:31:13Z")

</div>

> [@joebuhlig](#):
>
> In your case, @erikmolenaarnl, I would potentially write a plugin that edits the post text before it gets to the preview and cooks.

Thanks! Writing Discourse plugins is not a strength of mine. Could someone help me out to get started or write the plugin for me (for payment of course).

And I would like to share the code afterwards with the Discourse community!

---

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [28 februari 2018 om 20:15 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/14 "2018-02-28T20:15:35Z")

</div>

I do plugins quite a bit. Shoot me a quick email and we can work through the details. [joe@joebuhlig.com](mailto:joe@joebuhlig.com)

---

<div class="post-metadata">

### Author: ![erikmolenaarnl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erikmolenaarnl/32/76132_2.png) [@erikmolenaarnl](https://meta.discourse.org/u/erikmolenaarnl)
#### Post date: [13 maart 2018 om 11:03 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/15 "2018-03-13T11:03:08Z")

</div>

Hi @joebuhlig  
I’ve sent you an e-mail and DM but received no response yet.  
Could you please reply if you have some time so we can get started? Thanks 🙂

---

<div class="post-metadata">

### Author: ![erikmolenaarnl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erikmolenaarnl/32/76132_2.png) [@erikmolenaarnl](https://meta.discourse.org/u/erikmolenaarnl)
#### Post date: [19 april 2018 om 09:45 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/16 "2018-04-19T09:45:12Z")

</div>

Hello all,

The talented @joebuhlig wrote a great Discourse plugin which disables all HTML headers.

My brother @renem (of [NetworkLessons.com](http://NetworkLessons.com)) paid for this plugin and wants to share it with the Discourse community. If it can help more people out, please use it. It Rocks!

[https://github.com/HA-Tech/discourse-sanitize-header-tag](https://github.com/HA-Tech/discourse-sanitize-header-tag)

And @joebuhlig thanks again for the great work!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [3 september 2020 om 12:55 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/17 "2020-09-03T12:55:07Z")

</div>



---

<div class="post-metadata">

### Author: ![Terrapop](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@Terrapop](https://meta.discourse.org/u/Terrapop)
#### Post date: [3 september 2020 om 13:41 UTC](https://meta.discourse.org/t/disable-headers-in-replies-like-h1-and-h2/81775/18 "2020-09-03T13:41:53Z")

</div>

Great! Is this for all posts or is the initial post in a topic excluded?
