aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/content
diff options
context:
space:
mode:
authorGravatar kosayoda <[email protected]>2021-03-24 14:09:32 +0800
committerGravatar kosayoda <[email protected]>2021-03-24 14:09:32 +0800
commitbaebc131ed3be8d015acaad589b697983435037e (patch)
tree529446b257e76ee3a9b9fa7f5ee7d02b49f264ce /pydis_site/apps/content
parentUndo change to events app. (diff)
Refactor common HTML into a base template.
Diffstat (limited to 'pydis_site/apps/content')
-rw-r--r--pydis_site/apps/content/views/page_category.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/pydis_site/apps/content/views/page_category.py b/pydis_site/apps/content/views/page_category.py
index 7e8fe07d..623c2596 100644
--- a/pydis_site/apps/content/views/page_category.py
+++ b/pydis_site/apps/content/views/page_category.py
@@ -35,12 +35,17 @@ class PageOrCategoryView(TemplateView):
if self.full_location.is_dir():
context["categories"] = utils.get_categories(self.full_location)
- context["category_info"] = utils.get_category(self.full_location)
+ category = utils.get_category(self.full_location)
+ context["category_info"] = category
+ context["page_title"] = category["name"]
+ context["page_description"] = category["description"]
context["content"] = utils.get_pages(self.full_location)
context["path"] = f"{self.location}/" # Add trailing slash here to simplify template
elif self.full_location.with_suffix(".md").is_file():
page_result = utils.get_page(self.full_location.with_suffix(".md"))
context["page"] = page_result
+ context["page_title"] = page_result["metadata"]["title"]
+ context["page_description"] = page_result["metadata"]["description"]
context["relevant_links"] = page_result["metadata"].get("relevant_links", {})
else:
raise Http404