Traditional multi level hierarchy vs flat discourse hierarchy

Everything is possible in principle.

For example I’ve previously made a 3-level category hierarchy that also supports multiple tag intersections on the category level.

3-level category hierarchy with mutli-tag intersections route structure
scope "/multi" do
  constraints(tag_id: /[^\/]+?/, format: /json|rss/) do
     get '/c/:category/t/:tag_id/*tags' => 'tags#show', as: 'tags_category_show'
     get '/c/:parent_category/:category/t/:tag_id/*tags' => 'tags#show', as: 'tags_parent_category_category_show'
     get '/c/:grandparent_category/:parent_category/:category/t/:tag_id/*tags' => 'tags#show', as: 'tags_grandparent_category_category_show'

     Discourse.filters.each do |filter|
       get "/c/:category/t/:tag_id/*tags/l/#{filter}" => "tags#show_#{filter}", as: "tags_category_show_#{filter}"
       get "/c/:parent_category/:category/t/:tag_id/*tags/l/#{filter}" => "tags#show_#{filter}", as: "tags_parent_category_category_show_#{filter}"
       get "/c/:grandparent_category/:parent_category/:category/t/:tag_id/*tags/l/#{filter}" => "tags#show_#{filter}", as: "tags_grandparent_category_category_show_#{filter}"
     end
   end
end

This is more complex than what I think you want to do, but it’s not sustainable unless you’re willing to invest a lot of time or resources in supporting it. It would be likely to break at some point when standard Discourse changes.

With that context, there’s two things to understand about the category / tag route structure in standard Discourse:

  1. Multi-tag intersections are only possible site-wide; not at the category level, i.e. there aren’t routes in standard Discourse to show a topic list with topics in a specific category and with more than one specific tag. If you wanted this, you’d have to add the route.

  2. Category intersections are not possible. i.e. there isn’t a route in Discourse for showing topics from two categories on the same level (i.e. two parent categories or two child categories).

You can still achieve a four-level system (which seems to be your goal) without making significant server-side additions.

For example, you could exclusively use tags to represent the four levels. https://thepavilion.io/tags/intersection/events/bug/to-do/high represents the intersection between the tags, events, bug, to-do and high on Pavilion. You could have 4 dropdowns, one for each tag_group those tags are drawn from, e.g.

[plugin] [type] [status] [importance]

Once you’ve figured out how you want to structure your hierarchy within the existing Discourse route structure, the rest of the things you’ve listed are just client-side modifications and are (relatively) straighforward.

5 Likes