From bbb6fc242a4eb10551a8549c400f3db88658fce1 Mon Sep 17 00:00:00 2001 From: kosayoda Date: Thu, 1 Apr 2021 19:11:28 +0800 Subject: Add a dropdown menu listing direct children. This only shows when the page is also a category, since regular pages have no children and regular categories already list their children. --- pydis_site/apps/content/views/page_category.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pydis_site/apps/content/views') diff --git a/pydis_site/apps/content/views/page_category.py b/pydis_site/apps/content/views/page_category.py index 8783e33f..bb2c07cc 100644 --- a/pydis_site/apps/content/views/page_category.py +++ b/pydis_site/apps/content/views/page_category.py @@ -47,6 +47,13 @@ class PageOrCategoryView(TemplateView): else: raise Http404 + # Add subarticle information for dropdown menu if the page is also a category + if self.page_path.is_file() and self.category_path.is_dir(): + context["subarticles"] = [ + path.stem for path in self.category_path.iterdir() + if path.suffix != ".yml" + ] + context["breadcrumb_items"] = [ { "name": utils.get_category(settings.PAGES_PATH / location)["title"], -- cgit v1.2.3