From 10e1727c703d3cb91321e9ef51f54a0117efed19 Mon Sep 17 00:00:00 2001 From: kosayoda Date: Wed, 14 Apr 2021 23:45:24 +0800 Subject: Avoid duplicate entries for page and category. We have to add another check since `subarticles` is actually a list of dictionaries and not a dictionary, so key overriding does not work. We want the categories to take precedence over the pages in case of future feature expansion involving showing sub-sub-articles. --- pydis_site/apps/content/views/page_category.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 4031fde2..7427ec58 100644 --- a/pydis_site/apps/content/views/page_category.py +++ b/pydis_site/apps/content/views/page_category.py @@ -53,7 +53,7 @@ class PageOrCategoryView(TemplateView): context["subarticles"] = [] for entry in self.category_path.iterdir(): entry_info = {"path": entry.stem} - if entry.suffix == ".md": + if entry.suffix == ".md" and not entry.with_suffix("").is_dir(): entry_info["name"] = frontmatter.load(entry).metadata["title"] elif entry.is_dir(): entry_info["name"] = utils.get_category(entry)["title"] -- cgit v1.2.3