Is there any way to remove subcategories from the hamburger menu


(Pad Pors) #1

in the meta drop down menu next to user avatar, only categories are shown . This keeps the menu clean .

I couldn’t find any option in the setting searching for subcategory, how can I remove subcategories from the menu?

(Mittineague) #2

I guess I’m not understanding what you’re saying. The categories that show in the hamburger menu display all the categories I have permission to. Both parent categories and child categories.

(Joshua Rosenfeld) #3

You’re looking for this setting: Show subcategory list instead of topic list when entering a category.

Strangely, as far as I can tell, this controls both the display of subcategories in the hamburger menu, and whether they appear in the topic list - they can’t be controlled independently.

(Blake Erickson) #4

You don’t see this subcategory in the dropdown? extras - Discourse Meta

(cpradio) #5

He is trying to hide them. I think…

Taking Meta as an example, he wants to hide the highlighted items

(Blake Erickson) #6

Thanks for the screenshot! Yes I think he wants to hide them

but its looks like meta is also showing subcategories so we aren’t doing anything special either to show only categories. You will probably have to do some css magic, create a plugin, or create a setting for this and make a pr.

(Joshua Rosenfeld) #7

I’m confused, does the site setting I mentioned above not work? It seems to work fine for me…



Edit: Keep in mind, it’s also affecting the following…



(cpradio) #8

Works on my sandbox (never knew that setting also controlled that list)

(Joshua Rosenfeld) #9

@blake, can I infer from your post that separating the hamburger list and the topic list subcategory settings would be #pr-welcome?

(Sam Saffron) #10

What feature exactly are you asking for?

A discreet site setting for “hamburger only shows top level categories” ?

(Joshua Rosenfeld) #11

Yes. I’d like to be able to control the hamburger menu independently of the topic list.

(Sam Saffron) #12

A pr that adds the .subcategory class to the enclosing LI is welcome. Then you can do it with CSS.

A site setting is @codinghorror’s call

How to Hide sub categories in hamburger menu
(Joshua Rosenfeld) #15

I’ll take a stab at it after work.

(cpradio) #16

For reference, this is the file in question

(Joshua Rosenfeld) #17

OK - so I’ve been digging into this for quite some time now. First time working with widgets, so it took me some time to wrap my head around how everything works.

It looks like @neil committed a new feature that changes the way this works about 12 hours before @Pad_Pors’s first post. I believe this commit explains why we’re now seeing subcategories in the Meta hamburger menu. Primarily, the site setting I mentioned above doesn’t exist anymore. Secondly, I believe the commit as it currently stands is broken. Here’s the commit:

The commit appears to remove the site setting in favor of a per-category setting.

Here’s the line that I believe is broken (no idea how to fix it):

If I understand correctly, it says that “if the current category has show_subcategory_list enabled and the category has a parent category, return true”, and thus don’t add said category to the list. The problem is only a parent category can have the show_subcategory_list setting enabled, and parent categories can’t have parents, so this will never be true. It should be “if the current category’s parent has show_subcategory_list enabled and …”

I’ve still not figured out how to modify the CSS for subcategories only, but before I continue working I wanted to ensure my understanding of the code is correct, and ensure I’m hacking at working code.

(Jeff Atwood) #18

Probably a bug, @neil will look at it Monday when he is back.

(Neil Lalonde) #19

Yeah that was a bug. Fixed!

(Pad Pors) #20

I have upgraded to latest but I can’t fine this setting yet, should I wait more or is this option gone?

  • I can see the hamburger menu of meta is clean again, so I guess there should be a way to activate this now. is there?

(cpradio) #21

It is on each Category. So visit the Category, choose Edit Category, and it should be in one of the tabs.

(Cassie S) #22

I am having a similar difficulty. The hamburger menu is showing ALL my categories (including subcategories). I went in to the categories that have subcategories and selected subcategory list. That changed the category pages, but not the hamburger menu. So I’m not sure what to do.