What is the proper way to extend categories route and filter topics?

Hello,

The setup, implemented as a plugin and theme:
We have multiple tabs for every category, each with a different destination.

  • “About” links to a specific auto-generated topic that is invisible in the Topic list. (/t/topic-slug/20)

  • “Topics” is the list of “regular” topics, the usual behavior. (/c/parent-slug/child-slug/11)

  • “Events” is a list of topics that contain event invites (using discourse-calendar plugin). These topics will either be tagged “event”, or have archetype=“event”, or both. (/c/parent-slug/child-slug/11?archetype=event)

  • Members links to the group page of an auto-generated group assigned to this specific category. (/g/group-slug)

The problems:

  1. The primary issue is that we will have multiple kinds of topics. Currently we have “regular” and “event”, but we plan to add a few more, for business reasons. I’m going back and forth between using tags or Topic.archetype to distinguish between them, but whichever we use, we want to be able to filter topics of type under their corresponding tag, and have the list behave as usual. i.e. auto-loading of topics as you scroll should also be filtered by that topic type, and banners announcing a new topic being created should only appear if you’re viewing the tab of the topic type (regular or event) of the newly created topic. (i.e. “See 1 new or updated Event” should only appear if you’re viewing the Events tab)

  2. The secondary issue is, we want to extend the categories URL to make the tab urls consistent. i.e.

  • “About” links to “/c/parent-slug/child-slug/11/about”,
  • “Topics” links to “/c/parent-slug/child-slug/11/regular”,
  • “Events” links to “/c/parent-slug/child-slug/11/events”,
  • “Members” links to “/c/parent-slug/child-slug/11/members”,

We’ve looked for examples for plugins that do something similar to what we want , but the Favorites plugin is broken, and the [ Custom top navigation links](Custom top navigation links - #4 by Johani) theme component is for top level links.

Is there a proper way to make custom category-level routes, similar to “/c/category-slug/11/l/latest”, “/c/category-slug/11/l/new” and “/c/category-slug/11/l/top”? I’m thinking of using Tags to filter different types of Topics, but I’ve noticed the “new or updated topic” banner doesn’t appear when I’m filtered by tag. Is using archetypes then the way to go?

I realize this is a long post with multiple questions, but any input would be appreciated.

1 Like

I just moved your topic to #dev, consider changing the title so it reads more like a question and so people know you need some answers. Maybe something along the lines of “Is there a proper …?” or “What is the proper …?”

Currently, it reads as though you are telling the community the proper way to do this.

2 Likes