aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/content
diff options
context:
space:
mode:
authorGravatar kosayoda <[email protected]>2021-04-14 23:45:24 +0800
committerGravatar kosayoda <[email protected]>2021-04-14 23:45:24 +0800
commit10e1727c703d3cb91321e9ef51f54a0117efed19 (patch)
treef22468f5a455e48f3b5ab44814e612736f408f54 /pydis_site/apps/content
parentAdd contributing guides assets. (diff)
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.
Diffstat (limited to 'pydis_site/apps/content')
-rw-r--r--pydis_site/apps/content/views/page_category.py2
1 files changed, 1 insertions, 1 deletions
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"]