Indented / Nested Sidebar Categories or Subcategories

:information_source: Summary Indents / nests selected categories or subcategories in the sidebar
:hammer_and_wrench: Repository https://github.com/Lillinator/discourse-nested-categories
:eyeglasses: Preview Preview on Discourse Theme Creator
:question: Install Guide How to install a theme or theme component
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

There are two ways to use this simple theme component - to select categories or subcategories to indent (or nest) in the sidebar; or to allow indenting all but a select list of categories. Most people will want to indent only subcategories of course, to make them look nested, but you can indent any of your listed categories. Works in both desktop and mobile view, as well as header drop-down menu. Thanks to @dax for some of the code.

There are 3 settings - only use the first one, or the second and third one, depending on what you need to do.

Setting Description
indent only select categories List of selected categories or subcategories to indent.
indent all categories except the following Enable this setting if you want to indent all categories except those in the list setting below. Above list setting must be empty.
categories not to indent categories not to indent

Screenshots of settings and results in sidebar

Indent only selected categories

Summary

Setting:

Result:


Indent all categories except specified

Settings:

Result:


Note: if you want to hide the lock icon on the category bullets for private categories like in my screenshots above, you can use this component.

24 Likes

Yes!!! This is one step towards finally being able to use the sidebar!

3 Likes

Nice work, @Lilly!

It doesn’t quite hit the need of my instance, however. I’ve got a lot of subcategories and only a few categories - and the subcategories are quite dynamic.

It would be better for our instance if all categories+subcats were indented by default and the list was for the categories that shouldn’t be indented.

3 Likes

Hmmm, let me think about this - I see what you mean. Let me tinker with it a bit, but I’ll address your use case either way (with a separate component or a couple of additional settings). I was also thinking of including a setting that allowed for formatting or hiding the subcategory bullets. :thinking:

5 Likes

I have updated the component to allow configuring indented categories the opposite way - that is, indenting all but a select list. I hope this helps your use case. :slight_smile:

5 Likes

This is looking great in our community, thank you for this!

2 Likes

Please update this component. I pushed a minor update to it today to fix an issue where the “All categories” button was also indenting if the indent all categories except the following setting was being used.

4 Likes

Hey Lilly, I’m enjoing using this TC - in both ways!

But I’ve got a dumb question:

Why not simply make this component indent all of subcategories (and no categories) by default?

Great work @Lilly!

Is there any way to adjust this to work with Sub-Sub-Categories as well?

So there would be 2 levels of indenting available.

For example:
We have the category of Learning, with the Sub-Categories (Learning Tools & How To’s), the Sub-Sub-Categories of Games & Best Practices.
(Learning - learning tools - games) & (Learning - How To’s - Best Practices)

It would be great if we could nest games and best practices like this.

2 Likes

Doesn’t that look restless?

1 Like

Hi @Jagster,
I am not sure what you mean by that. Sorry :frowning:

Eyes will wonder because nothing is in straight lines. Thats why we try keep spacing etc. as much same as possible in texts, toolbars… And at same time icons and colors changes too. The icon of main category has some information value, others no. That doesn’t make navigation easier, but opposite. And all of that is basically the main reasons why deep nesting is an bad idea, no matter if we are talking books or web. Plus you lost precious space and names of categories aren’t names any more.

And if you really has that huge amount of specific topics that you must use several main categories and at least same amount sub-categories, because you have plenty of sub-sub-categories (and all the time mains and first level subs are just headers showing other categories), that will lead to so long sidebar that there is absolut no one who would use it.

Hate to this at loud, but that looks totally same than css snippets where intends are used to show logical structure of { } pairs. It is never ment to reading.

2 Likes

Thank you for elaborating on your thoughts here @Jagster. I truly appreciate your feedback.

You make a lot of great points, especially about not creating an excessively long sidebar and the colors and icons not flowing together.

I do wish that I could expand the nested categories like an accordion, then we could have the best of both worlds, a short sidebar, but also quick navigation through the site.

1 Like

i’d recommend reading this topic, especially the posts about Wix forum and it’s category simplicity.

Also keep in mind that your users can customize their own category sidebar sections.

Honestly, I don’t see how sub-sub-categories would work here with nesting - it would create a bit of a visual mess I think. Not even sure if it’s possible to build into this component…

5 Likes