# Hide sidebar from anon users

**URL:** https://meta.discourse.org/t/hide-sidebar-from-anon-users/250351
**Category:** Theme component
**Tags:** deprecated, sidebar
**Created:** [January 1, 2023, 11:00pm UTC](https://meta.discourse.org/t/hide-sidebar-from-anon-users/250351 "2023-01-01T23:00:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [January 1, 2023, 11:00pm UTC](https://meta.discourse.org/t/hide-sidebar-from-anon-users/250351/1 "2023-01-01T23:00:24Z")

</div>

This TC has been deprecated in favour of:

> [@Navigation (sidebar) menu display control](https://meta.discourse.org/t/navigation-sidebar-menu-display-control/277687):
>
> information_sourceSummary Allows displaying sections and links for staff, logged-in and anon usershammer_and_wrenchRepository [https://github.com/Lillinator/navigation-menu-display-control](https://github.com/Lillinator/navigation-menu-display-control)questionInstall Guide [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Description The Navigation Menu Display Control theme component allows for the display of various default…

| | | |
| --- | --- | --- |
| ℹ | **Summary** | Hides the #sidebar from anon users. This is helpful if you have a mostly private site with a small amount of content publicly visible. |
| 🛠 | **Repository** | [GitHub - nathan-nz/discourse-hide-sidebar-from-anon: Hides the sidebar from anonymous users · GitHub](http://github.com/nathan-nz/discourse-hide-sidebar-from-anon) |
| ❓ | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |
| 📖 | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

Install this theme component

This simple theme component adds in CSS to give a cleaner experience for anon users by hiding the #sidebar.

You might want to do this if (like us) you have a predominantly private site which has one or two categories set to `everyone` (and thus exposed to the internet). It means that casual visitors see a very simple interface that is congruent with the small amount of content they see, while logged in users get the full experience.

This was put together from the code kindly provided by @Don here:

> [@How do I hide the sidebar for anon viewers?](https://meta.discourse.org/t/how-do-i-hide-the-sidebar-for-anon-viewers/250311/2):
>
> Hello, With this you can hide the sidebar for anons. slightly_smiling_face Common / CSS html.anon { // Hide the narrow desktop sidebar // sidebar mobile version which is activate on desktop too under 1000px width .d-header .hamburger-panel { display: none; } // Hide the header cloak when menu opens .header-cloak { display: none !important; } } Desktop / CSS html.anon { // If sidebar opened use the closed style body.has-sidebar-page { #main-outlet-wrapper { …

---

<div class="post-metadata">

### Author: ![Ayelen\_Rives](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ayelen_rives/32/226978_2.png) [@Ayelen\_Rives](https://meta.discourse.org/u/Ayelen_Rives)
#### Post date: [March 1, 2023, 3:53pm UTC](https://meta.discourse.org/t/hide-sidebar-from-anon-users/250351/2 "2023-03-01T15:53:26Z")

</div>

Thank you! It’s really useful and I’ll give it a try.

Do you know if there is a way to show only some things on the sidebar and don’t show others? For instance, I don’t wanna show to anon the Community tabs, but I do wanna show them categories and tags.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [March 2, 2023, 1:20am UTC](https://meta.discourse.org/t/hide-sidebar-from-anon-users/250351/3 "2023-03-02T01:20:22Z")

</div>

That is pretty straightforward with a bit of CSS targetting `.anon`:

```css
.anon div.sidebar-section-community {
     display: none;
}

```

If I get the chance I’ll roll that functionality into this TC.

---

<div class="post-metadata">

### Author: ![Ayelen\_Rives](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ayelen_rives/32/226978_2.png) [@Ayelen\_Rives](https://meta.discourse.org/u/Ayelen_Rives)
#### Post date: [March 2, 2023, 12:23pm UTC](https://meta.discourse.org/t/hide-sidebar-from-anon-users/250351/4 "2023-03-02T12:23:47Z")

</div>

Thank you! ✨ That’s great!!

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [June 7, 2023, 4:03pm UTC](https://meta.discourse.org/t/hide-sidebar-from-anon-users/250351/5 "2023-06-07T16:03:04Z")

</div>

> [@nathank](#):
>
> If you want to do more than what my simple TC offers, check out this new and far more powerful version by @Lilly:

thanks @nathank. i thought about adding your theme’s functionality to mine but i’ve left it out because it seems like a special case component for forums with private small membership, and yours works just fine. cheers! 🙂

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [June 15, 2023, 5:02am UTC](https://meta.discourse.org/t/hide-sidebar-from-anon-users/250351/6 "2023-06-15T05:02:36Z")

</div>

Nah, I think that it is time to depreciate this one now that it’s functionality has been rolled into yours:

[https://github.com/Lillinator/Sidebar-Modifier/pull/1](https://github.com/Lillinator/Sidebar-Modifier/pull/1)

---

<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 18, 2024, 6:35pm UTC](https://meta.discourse.org/t/hide-sidebar-from-anon-users/250351/7 "2024-06-18T18:35:13Z")

</div>


