Re-Ordering Categories


I have just gone through our 121 categories/sub-categories in an attempt to re-order them. It was challenging to say the least.

I decided to implement a numbering system which would separate the categories by thousands, e.g.

1000 - category one
2000 - category two

with sub-categories numbered in multiples of ten in between, I figured this would allow me to re-order later on without having to re-order everything.

1000 - category one
1010 - category one, sub-category one
1020 - category one, sub-category two
2000 - category two
2010 - category two, sub-category one

I found that as I typed a number the box automatically jumped to its new position, but, because the cursor didn’t have focus, the model window didn’t automatically scroll down. Also, after the key press it assumed I was done, for example, if I was to try and type “300” after “30” the box would move, focus would be lost. In the end I used a text editor to type the numbers and then copy and paste them into each box. It took a while and was a bit of effort but eventually, I had removed all of the issues and everything was organised nicely.

The Re-Organise Categories model offered three buttons;

  • Fix Positions
  • Apply
  • Save

Save was disabled, I applied the changes. Save was still disabled. The only way to actually change anything was to click “Fix Positions”, at this point, all of my carefully hand-crafted numbering reverted to a sequential flow of integers, I had lost all of the “spacing” I had injected.

Thankfully, all of the categories and sub-categories were at least in the order I wanted them in, but it wasn’t overly obviously that I couldn’t just number these however I wished. It also wasn’t overly obviously what the “Fix Positions” button was going to do, the hover text just suggested that I had some duplicate numbers, which I didn’t as I had checked them thoroughly.

The ability to have the numbers entered for positioning I think would be beneficial, especially for forums with large quantities of categories/sub-categories. In our specific case they represent courses and sections of courses, as such they will always be being added to and from time to time need some re-jiggling as we may want to move a course to be more prominent on the forum.


I agree, our category ordering is ripe for its next iteration. This is one of those few areas where drag-and-drop excels. I’d like it to work almost exactly like WordPress menus:


oooh, now that looks nice.

I was about to ask whether it would be possible to have the sub-categories automatically move when the primary category moves, but with the above image, it looks like that would be taken care of, e.g. if I were to drag “Technology” up above “Howto”, all of its children would move also (“PHP”, “html” and “html5” etc).

The only thing that springs to mind is that you can also currently set the order of a category on it’s own settings screen, it presumably wouldn’t make sense to see all of the categories/sub-categories on that page, but perhaps a primary category should allow the re-sorting of its child categories, without having to go to an “all categories” screen?


Possibly, but I’d probably rather defer that interface to “the one true category sorting page” so there’s less overhead. But we should definitely link to it via that settings page. I also don’t think we need position exposed in category-specific settings. If you can’t see what position the other categories are in, this number is fairly useless.


Thanks for the replies and thoughts on this topic Erlend, I look forward to being able to try any new functionality around this feature in the near future :slight_smile:

Hopefully! It’ll definitely not make it into Discourse Version 1.9 though as that is due this month and we’re practically at feature freeze already.


No worries, I understand, all good things come to those who wait (or pay! :smiley: ) :slight_smile:


A simple quick-fix will be to have parent categories bring their children with them when they move.

And disable the relevant up/down arrows for subcategories when it is already on top/bottom of the parent.

This way should at least solve the majority of usability prob, except that creating a new subcategory or moving one among parents etc will necessitate reassigning the sort order numbers.

Continued here: