מספר הנושאים בקטגוריה

סיכום מבוסס בינה מלאכותית

In a discussion titled “Number of topics in a category” under the Support category, tpetrov asked how to view the number of topics in a category. rishabh provided a Data Explorer SQL query to retrieve topic and post counts per category, including a screenshot for clarity. tpetrov thanked rishabh for the solution. Later, codinghorror suggested that visiting the categories page (e.g., https://meta.discourse.org/categories) would display the counts directly. tpetrov acknowledged this, admitting they had overlooked it. However, in post 8, tpetrov clarified that while the count appears on meta.discourse.org, it does not display on their own community site because they are using the “boxes” layout, which omits the topic count. The thread thus highlights both a direct UI solution and a workaround via Data Explorer, while noting layout-specific limitations.

How can I see how many topics a category consist of?

Hey Toni,

Does this Data Explorer query work for your needs? It will show you a count of topics and posts in each category:

image

SELECT category_id, 
       stats.topic_count, 
       stats.post_count 
FROM   categories ccc 
       LEFT JOIN (SELECT topics.category_id, 
                         Count(*)       topic_count,
                         SUM(topics.posts_count) post_count
                         FROM   topics 
                          
                  WHERE  ( "topics"."deleted_at" IS NULL ) 
                         AND ( topics.id NOT IN (SELECT cc.topic_id 
                                                 FROM   categories cc 
                                                 WHERE  topic_id IS NOT NULL) ) 
                         AND "topics"."visible" = true 
                  GROUP  BY topics.category_id 
                        ) stats 
              ON stats.category_id = ccc.id

Awesome, thanks @rishabh

Isn’t this possible by visiting the categories page? Categories - Discourse Meta

Yeah, it is. I don’t know how I missed that.

Now I know - it shows it on meta, but not on our community since we are using the boxes layout (and it doesn’t have the count apparently)