diff options
author | 2022-08-14 05:34:27 +0200 | |
---|---|---|
committer | 2022-08-14 05:46:36 +0200 | |
commit | 45cdb27a82297ede18d7bd908213dde54fef06a9 (patch) | |
tree | b31c1aa6fa7d9676837f7dd8488b5e5a8eed6b4f /pydis_site/apps/content/urls.py | |
parent | Move Tag URL To Property And Add Group (diff) |
Add Tag Group Support
Adds support for tag groups in content. This involves some modification
to the routing, and templating.
Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'pydis_site/apps/content/urls.py')
-rw-r--r-- | pydis_site/apps/content/urls.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pydis_site/apps/content/urls.py b/pydis_site/apps/content/urls.py index b4ffc07d..03c0015a 100644 --- a/pydis_site/apps/content/urls.py +++ b/pydis_site/apps/content/urls.py @@ -39,15 +39,21 @@ def get_all_pages() -> DISTILL_RETURN: def get_all_tags() -> DISTILL_RETURN: - """Return all tag names in the repository in static builds.""" + """Return all tag names and groups in static builds.""" + groups = {None} for tag in utils.get_tags_static(): - yield {"name": tag.name} + groups.add(tag.group) + yield {"location": (f"{tag.group}/" if tag.group else "") + tag.name} + + groups.remove(None) + for group in groups: + yield {"location": group} urlpatterns = [ distill_path("", views.PageOrCategoryView.as_view(), name='pages'), distill_path( - "tags/<str:name>/", + "tags/<path:location>/", views.TagView.as_view(), name="tag", distill_func=get_all_tags |