aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/content
diff options
context:
space:
mode:
authorGravatar kosayoda <[email protected]>2021-03-27 12:42:07 +0800
committerGravatar kosayoda <[email protected]>2021-03-27 12:42:07 +0800
commit624e87d15ccfbe4ba2410dcaab0b4fb494b664e5 (patch)
treeb2ac7802499d296af35df2ff0ebc457d7e9384e3 /pydis_site/apps/content
parentMerge pull request #393 from ks129/guides-app (diff)
Improve content page and listing metadata keys.
Make category `title` consistent with page `title`. Simplify `icon` key, since there is no benefit to defining the icon class and the icon separately. Allow overriding the `icon` for category entries just like page entries.
Diffstat (limited to 'pydis_site/apps/content')
-rw-r--r--pydis_site/apps/content/resources/_info.yml2
-rw-r--r--pydis_site/apps/content/resources/guides/_info.yml2
-rw-r--r--pydis_site/apps/content/resources/guides/pydis-guides/_info.yml2
-rw-r--r--pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md12
-rw-r--r--pydis_site/apps/content/views/page_category.py5
5 files changed, 11 insertions, 12 deletions
diff --git a/pydis_site/apps/content/resources/_info.yml b/pydis_site/apps/content/resources/_info.yml
index 583cab18..6553dcc6 100644
--- a/pydis_site/apps/content/resources/_info.yml
+++ b/pydis_site/apps/content/resources/_info.yml
@@ -1,2 +1,2 @@
-name: Pages
+title: Pages
description: Guides, articles, and pages hosted on the site.
diff --git a/pydis_site/apps/content/resources/guides/_info.yml b/pydis_site/apps/content/resources/guides/_info.yml
index 59c60a7b..2f65eaf9 100644
--- a/pydis_site/apps/content/resources/guides/_info.yml
+++ b/pydis_site/apps/content/resources/guides/_info.yml
@@ -1,2 +1,2 @@
-name: Guides
+title: Guides
description: Made by us, for you.
diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/_info.yml b/pydis_site/apps/content/resources/guides/pydis-guides/_info.yml
index 7c9a2225..c126a68a 100644
--- a/pydis_site/apps/content/resources/guides/pydis-guides/_info.yml
+++ b/pydis_site/apps/content/resources/guides/pydis-guides/_info.yml
@@ -1,2 +1,2 @@
-name: Python Discord Guides
+title: Python Discord Guides
description: Guides related to the Python Discord server and community.
diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md b/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md
index f258ef74..51486bfe 100644
--- a/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md
+++ b/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md
@@ -1,8 +1,7 @@
---
title: How to Contribute a Page
description: Learn how to write and publish a page to this website.
-icon_class: fas
-icon: fa-info
+icon: fas fa-info
relevant_links:
Contributing to Site: https://pythondiscord.com/pages/contributing/site/
Using Git: https://pythondiscord.com/pages/contributing/working-with-git/
@@ -27,8 +26,9 @@ For example, the file `pydis_site/apps/content/resources/hello-world.md` will re
Nested folders represent page categories on the website. Each folder under the root folder must include a `_info.yml` file with the following:
```yml
-name: Category name
+title: Category name
description: Category description
+icon: fas fa-folder # Optional
```
All the markdown files in this folder will then be under this category.
@@ -44,8 +44,7 @@ The metadata is written in YAML, and should be enclosed in triple dashes `---` *
---
title: How to Contribute a Page
description: Learn how to write and publish a page to this website.
-icon_class: fas
-icon: fa-info
+icon: fas fa-info
relevant_links:
Contributing to Site: https://pythondiscord.com/pages/contributing/site/
Using Git: https://pythondiscord.com/pages/contributing/working-with-git/
@@ -59,8 +58,7 @@ Pages, which include guides, articles, and other static content,...
- **description:** Short, 1-2 line description of the page's content.
### Optional Fields
-- **icon_class:** Favicon class for the category entry for the page. Default: `fab`
-- **icon:** Favicon for the category entry for the page. Default: `fa-python` <i class="fab fa-python is-black" aria-hidden="true"></i>
+- **icon:** Icon for the category entry for the page. Default: `fab fa-python` <i class="fab fa-python is-black" aria-hidden="true"></i>
- **relevant_links:** A YAML dictionary containing `text:link` pairs. See the example above.
## Extended Markdown
diff --git a/pydis_site/apps/content/views/page_category.py b/pydis_site/apps/content/views/page_category.py
index eec4e7e5..723c5ad0 100644
--- a/pydis_site/apps/content/views/page_category.py
+++ b/pydis_site/apps/content/views/page_category.py
@@ -38,8 +38,9 @@ class PageOrCategoryView(TemplateView):
context["pages"] = utils.get_category_pages(self.full_location)
category = utils.get_category(self.full_location)
- context["page_title"] = category["name"]
+ context["page_title"] = category["title"]
context["page_description"] = category["description"]
+ context["icon"] = category.get("icon")
context["path"] = f"{self.location}/" # Add trailing slash here to simplify template
elif self.full_location.with_suffix(".md").is_file():
@@ -53,7 +54,7 @@ class PageOrCategoryView(TemplateView):
context["breadcrumb_items"] = [
{
- "name": utils.get_category(settings.PAGES_PATH / location)["name"],
+ "name": utils.get_category(settings.PAGES_PATH / location)["title"],
"path": str(location)
} for location in reversed(self.location.parents)
]