# How can I hide the Badges link in the sidebar?

**URL:** https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488
**Category:** Development
**Tags:** css, sidebar
**Created:** [September 30, 2022, 9:55am UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488 "2022-09-30T09:55:00Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [September 30, 2022, 9:55am UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/1 "2022-09-30T09:55:00Z")

</div>

I imagine that sidebar customisation will be added in due course, but for now I’d like to remove the “Badges” link, or at least hide it within “More…”

Should I just use CSS to hide it, for the time being?

I can’t quite work out the CSS. The divs containing the links are of class `sidebar-section-link-wrapper` with no id. When I try to hide the a tag with `a.sidebar-section-link-badges { display: none; }` it doesn’t hide anything.

---

<div class="post-metadata">

### Author: ![tempogain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tempogain/32/134055_2.png) [@tempogain](https://meta.discourse.org/u/tempogain)
#### Post date: [October 2, 2022, 2:30am UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/2 "2022-10-02T02:30:32Z")

</div>

Hello, in the hamburger menu I’ve used “nth-child” to do this kind of thing

[https://www.w3schools.com/cssref/sel\_nth-child.asp](https://www.w3schools.com/cssref/sel_nth-child.asp)

---

<div class="post-metadata">

### Author: ![Simon\_Manning](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_manning/32/198596_2.png) [@Simon\_Manning](https://meta.discourse.org/u/Simon_Manning)
#### Post date: [October 2, 2022, 10:32am UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/3 "2022-10-02T10:32:31Z")

</div>

`nth-child` is very useful for many things, however in this case I think it’s probably dangerous. Since it’s based solely on numbers, for this it would require a guarantee that Badges will remain in the same position.

If something else is added/removed/moved before it, the position of Badges will change which could lead to Badges being revealed, something else being hidden and that may go unnoticed.

`:has()` is ideal for this, however sadly its support is still limited, notably it’s disabled by default in Firefox and is missing from many mobile browsers.

If hiding it isn’t critical for you, i.e. it’s acceptable to hide it where possible for best experience while being visible in browsers that do not yet support `:has()`, you can use the following selector:

```plaintext
sidebar-section-link-wrapper:has(a.sidebar-section-link-badges) { display: none; }

```

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [October 2, 2022, 10:36am UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/4 "2022-10-02T10:36:07Z")

</div>

Thanks for the ideas. I’ll likely do that for now. But I hope that `id`s can be added.

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [October 2, 2022, 1:02pm UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/5 "2022-10-02T13:02:27Z")

</div>

Hello,

You can hide it with this. 🙂

```scss
.sidebar-section-link-wrapper {
  .sidebar-section-link.sidebar-section-link-badges {
    display: none;
  }
}

```

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [October 2, 2022, 1:09pm UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/6 "2022-10-02T13:09:58Z")

</div>

I just copied and pasted this into my old theme component (which did the same with the old hamburger menu) and it just worked! Thank you very much, and thanks again to everybody else too.

---

<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: [November 1, 2022, 1:10pm UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/7 "2022-11-01T13:10:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [November 20, 2022, 4:12pm UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/8 "2022-11-20T16:12:58Z")

</div>



---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [November 20, 2022, 5:20pm UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/9 "2022-11-20T17:20:08Z")

</div>

Unfortunately this CSS doesn’t seem to be working with 2.9.0beta12… any ideas? 🙂

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [November 20, 2022, 5:38pm UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/10 "2022-11-20T17:38:54Z")

</div>

[This](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/5) still works for me on the latest version.

 ![Screenshot 2022-11-20 at 18.35.51](https://global.discourse-cdn.com/meta/original/4X/0/e/a/0eadb39010cf430d7c98bb205701103bc86c7b4c.png)

* * *

Can you share your code?

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [November 20, 2022, 6:40pm UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/11 "2022-11-20T18:40:25Z")

</div>

I apologise. It does work. I’d commented it out because of the bug with the “More” link.

That bug is that the link is displayed even when there are no “More” menu options. With the number of options on my forum, with the Badges option _present_, even though I don’t want it there, at least “More” has something to do! (The problem remains… when you’re on the Badges page itself, the useless “More” link is there.) ["More..." shows in sidebar when there is nothing more](https://meta.discourse.org/t/more-shows-in-sidebar-when-there-is-nothing-more/240640)

For some reason the “paste url over text to create hyperlink” feature didn’t work when editing this post.

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [November 21, 2022, 9:08am UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/12 "2022-11-21T09:08:22Z")

</div>

I see. Actually I think that is not a bug because the `More` menu options are in there but hidden so it is not empty. But If I understand correctly you hide everything inside `More` menu? If this is the case I think hide the whole `More` section would be better?

To hide the `More` menu dropdown from all pages:

```scss
// hide More menu from all pages
.sidebar-more-section-links-details {
  display: none;
}

```

* * *

If you want to hide it on specific page you can use the body class to target it.

You can find it here.

 ![Screenshot 2022-11-21 at 9.49.48](https://global.discourse-cdn.com/meta/original/4X/9/d/5/9d505667d2da351c6e12ca187e1eaedc23e441cb.png)

For example on badges page it will looks like this:

```scss
// hide More menu from specific page (badges)
body.badges-page {
  .sidebar-more-section-links-details {
    display: none;
  }
}

```

This will hide the More dropdown but show the **Badges** on the sidebar.

 ![Screenshot 2022-11-21 at 9.41.02](https://global.discourse-cdn.com/meta/original/4X/4/d/e/4deacebe54679a37046fcc0d435c3e52ed789610.png)

* * *

But if you use the previous code to hide Badges then that won’t show up too.

```scss
// hide badges More menu item
.sidebar-section-link-wrapper {
  .sidebar-section-link.sidebar-section-link-badges {
    display: none;
  }
}

// hide More menu from specific page (badges)
body.badges-page {
  .sidebar-more-section-links-details {
    display: none;
  }
}

```

 ![Screenshot 2022-11-21 at 9.46.53](https://global.discourse-cdn.com/meta/original/4X/d/0/7/d07737a13e474dde1e74225a2570f300e1df6f7e.png)

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [November 21, 2022, 9:57am UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/13 "2022-11-21T09:57:55Z")

</div>

I see it as a bug because I don’t think a “More” option should ever appear unless there **are** more things and therefore clicking “More” has some effect. The bug report is here: ["More..." shows in sidebar when there is nothing more](https://meta.discourse.org/t/more-shows-in-sidebar-when-there-is-nothing-more/240640)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:36pm UTC](https://meta.discourse.org/t/how-can-i-hide-the-badges-link-in-the-sidebar/240488/14 "2024-06-08T12:36:44Z")

</div>

This topic was automatically closed after 617 days. New replies are no longer allowed.
