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.

23 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:

4 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:

4 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.

2 Likes