# Hacking discourse to create sub-sub categories

**URL:** https://meta.discourse.org/t/hacking-discourse-to-create-sub-sub-categories/63454
**Category:** Development
**Created:** [5월 26, 2017, 8:17오후 UTC](https://meta.discourse.org/t/hacking-discourse-to-create-sub-sub-categories/63454 "2017-05-26T20:17:45Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Mehal\_Shah](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@Mehal\_Shah](https://meta.discourse.org/u/Mehal_Shah)
#### Post date: [5월 26, 2017, 8:17오후 UTC](https://meta.discourse.org/t/hacking-discourse-to-create-sub-sub-categories/63454/1 "2017-05-26T20:17:45Z")

</div>

Hi folks,

I need to create one additional level of categorization for our forum for [Code.org](http://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](https://github.com/discourse/discourse/blob/master/app/controllers/list_controller.rb#L107) 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?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [5월 26, 2017, 8:21오후 UTC](https://meta.discourse.org/t/hacking-discourse-to-create-sub-sub-categories/63454/2 "2017-05-26T20:21:58Z")

</div>

> [@Mehal\_Shah](#):
>
> Then I add a route for something like c/:parent\_category/:category/:tag that loads topics in a given category with a given tag.

[https://meta.discourse.org/tags/c/howto/faq/badge](https://meta.discourse.org/tags/c/howto/faq/badge) works out of the box.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [5월 26, 2017, 8:45오후 UTC](https://meta.discourse.org/t/hacking-discourse-to-create-sub-sub-categories/63454/3 "2017-05-26T20:45:32Z")

</div>

> [@Mehal\_Shah](#):
>
> so I’m willing to fork discourse and do some hackery on my own.

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.

---

<div class="post-metadata">

### Author: ![r3d\_f0x](https://avatars.discourse-cdn.com/v4/letter/r/3da27b/32.png) [@r3d\_f0x](https://meta.discourse.org/u/r3d_f0x)
#### Post date: [5월 26, 2017, 8:59오후 UTC](https://meta.discourse.org/t/hacking-discourse-to-create-sub-sub-categories/63454/4 "2017-05-26T20:59:53Z")

</div>

> [@sam](#):
>
> 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.

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.

---

<div class="post-metadata">

### Author: ![Mehal\_Shah](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@Mehal\_Shah](https://meta.discourse.org/u/Mehal_Shah)
#### Post date: [5월 26, 2017, 9:58오후 UTC](https://meta.discourse.org/t/hacking-discourse-to-create-sub-sub-categories/63454/5 "2017-05-26T21:58:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5월 26, 2017, 11:49오후 UTC](https://meta.discourse.org/t/hacking-discourse-to-create-sub-sub-categories/63454/6 "2017-05-26T23:49:26Z")

</div>

So you want to make the homepage /tags?

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

---

<div class="post-metadata">

### Author: ![Mehal\_Shah](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@Mehal\_Shah](https://meta.discourse.org/u/Mehal_Shah)
#### Post date: [5월 27, 2017, 12:00오전 UTC](https://meta.discourse.org/t/hacking-discourse-to-create-sub-sub-categories/63454/7 "2017-05-27T00:00:23Z")

</div>

Sure!

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

 ![](https://global.discourse-cdn.com/meta/original/3X/b/6/b66c6e083ef9663ebb1c9195fa347e0e63331d9c.png)

We click on “Exploring Computer Science” to get the [Exploring Computer Science - Code.org Professional Learning Community](http://forum.code.org/c/ecs) which renders subcategories for each unit

 ![](https://global.discourse-cdn.com/meta/original/3X/4/0/4057e099337c9a3dead019cf8815d554cfbfc870.png)

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

 ![](https://global.discourse-cdn.com/meta/original/3X/3/0/30a8695beaa91225e7d30de3267806fd9053e37b.png)

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

 ![](https://global.discourse-cdn.com/meta/original/3X/1/0/100e79cdc13acf6daa25382dff0476dc764d4347.png)

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

---

<div class="post-metadata">

### Author: ![scombs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/scombs/32/48616_2.png) [@scombs](https://meta.discourse.org/u/scombs)
#### Post date: [5월 27, 2017, 10:11오후 UTC](https://meta.discourse.org/t/hacking-discourse-to-create-sub-sub-categories/63454/8 "2017-05-27T22:11:22Z")

</div>

Adding a category option for **sort by topic title**  
would help for this and other use cases [as discussed previously](https://meta.discourse.org/t/sort-topics-within-category-by-topic-title/56139).

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