From 8e00055c8cf8efe118af1f05154377a0f4a6a677 Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Sun, 3 May 2026 07:51:39 +0800 Subject: [PATCH] fix(website): remove duplicate tag on group/category pages The category template rendered a tag for `category.name` plus a tag for `entry.groups[0]`, which duplicated the group name on group pages where those values are identical (e.g. /categories/python-language/ showing "Python Language" twice). It also never rendered `entry.categories`, so group pages omitted each project's actual category. Mirror the index template's tag rendering on category, group, and subcategory pages, and mark whichever tag matches the current page URL as active. Pass `category_urls` and `current_path` to each render call so the template can match by URL. --- website/build.py | 6 ++++++ website/templates/category.html | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/website/build.py b/website/build.py index 7c87f986..4b65d2bc 100644 --- a/website/build.py +++ b/website/build.py @@ -369,6 +369,8 @@ def build(repo_root: Path) -> None: entries=category_entries, total_categories=len(categories), page_kind="category", + category_urls=category_urls, + current_path=category_path(category), ), encoding="utf-8", ) @@ -390,6 +392,8 @@ def build(repo_root: Path) -> None: entries=group_entries, total_categories=len(categories), page_kind="group", + category_urls=category_urls, + current_path=group_path(group["slug"]), ), encoding="utf-8", ) @@ -425,6 +429,8 @@ def build(repo_root: Path) -> None: total_categories=len(categories), page_kind="subcategory", parent_category=category, + category_urls=category_urls, + current_path=subcategory_path(category["slug"], sub["slug"]), ), encoding="utf-8", ) diff --git a/website/templates/category.html b/website/templates/category.html index c17cebc5..b3af6507 100644 --- a/website/templates/category.html +++ b/website/templates/category.html @@ -117,18 +117,25 @@ {% for subcat in entry.subcategories %} - {% endfor %} - + {% for cat in entry.categories %} + {{ cat }} + {% endfor %} {% if entry.groups %} + {% set group_url = "/categories/" ~ (entry.groups[0] | slugify) ~ "/" %}