Hacking discourse to create sub-sub categories

(Mehal Shah) #1

Hi folks,

I need to create one additional level of categorization for our forum for Code.org. I’d like people to click a category (High School Computer Science), and see a list of our courses (Course 1, Course 2, Course 3), then click Course 1 and see a list of units in the course (Unit 1, Unit 2, Unit 3). Under each unit, there would be topics.

I know that this isn’t supported out of the box for discourse, so I’m willing to fork discourse and do some hackery on my own. I see a couple of ways of doing this

  • Add a method to the list controller - like parent_category_category_subcategory here and add appropriate routing to it.

  • Use tags. People who post topics have their posts tagged with the appropriate unit (somehow - don’t know how yet). Then I add a route for something like c/:parent_category/:category/:tag that loads topics in a given category with a given tag. I’ll also have to change the category view to render tags as subcategories.

Are either of these solutions plausible? Is there a third way I should be considering?

(Rafael dos Santos Silva) #2

Topics tagged badge works out of the box.

(Sam Saffron) #3

no no no … don’t do that … it will end in huge amounts of pain over time, forks always turn out terrible.

Strongly recommend you simply use tags here, they already work.

(r3d_f0x) #4

I agree. It seems like a cool idea to fork a project and make it your own and include all the things you want but unless you have a whole team that is willing to work on it long term - and they don’t just have short term enthusiasm for it - it’s going to turn into a nightmare.

(Mehal Shah) #5

That’s nice - what I’d want is for that tag to show up in the category view like another topic though.

(Jeff Atwood) #6

So you want to make the homepage /tags?

Can you mock up what you think this should look like?

(Mehal Shah) #7


Right now, here’s the root of our forum that lists out categories

We click on “Exploring Computer Science” to get the Exploring Computer Science - Code.org Professional Learning Community which renders subcategories for each unit

When I click into the subcategory for unit 1 I get this list of topics

However, what I want when I click into the subcategory is something like

Clicking lesson 1 would take the user to a url like forum.code.org/c/ecs/unit1/t/lesson1 - Essentially all topics in the unit1 subcategory that have been tagged with lesson 1

(Steve Combs) #8

Adding a category option for sort by topic title
would help for this and other use cases as discussed previously.

This would allows an easy way to display topics in order based on naming convention, not last edit.