diff --git a/tildes/tildes/templates/topic_listing.jinja2 b/tildes/tildes/templates/topic_listing.jinja2
index 7eec9fd..37d3fec 100644
--- a/tildes/tildes/templates/topic_listing.jinja2
+++ b/tildes/tildes/templates/topic_listing.jinja2
@@ -224,6 +224,17 @@
{{ group.sidebar_rendered_html|safe }}
{% endif %}
+ {% if subgroups %}
+
+ - Subgroups
+
+ {% for subgroup in subgroups %}
+ - {{ group_linked(subgroup.path) }}
+ {% endfor %}
+
+
+ {% endif %}
+
{% if wiki_pages or wiki_has_index %}
- Group wiki pages
diff --git a/tildes/tildes/views/topic.py b/tildes/tildes/views/topic.py
index b6b96a6..fd04e2c 100644
--- a/tildes/tildes/views/topic.py
+++ b/tildes/tildes/views/topic.py
@@ -157,10 +157,20 @@ def get_group_topics(
groups = [
group for group in request.query(Group).all() if group.path != "test"
]
+ subgroups = None
else:
# otherwise, just topics from the single group that we're looking at
groups = [request.context]
+ subgroups = (
+ request.query(Group)
+ .filter(
+ Group.path.descendant_of(request.context.path),
+ Group.path != request.context.path,
+ )
+ .all()
+ )
+
default_settings = _get_default_settings(request, order)
if order is missing:
@@ -245,6 +255,7 @@ def get_group_topics(
"unfiltered": unfiltered,
"wiki_pages": wiki_pages,
"wiki_has_index": wiki_has_index,
+ "subgroups": subgroups,
}