Skip to content

Commit 4b9444d

Browse files
committed
fixes
1 parent 3a669f2 commit 4b9444d

4 files changed

Lines changed: 83 additions & 31 deletions

File tree

generator.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def render_skill_item(skill: dict[str, Any], project_ids: dict[str, str]) -> str
180180
return render_template("partials/skill_item.html", context)
181181

182182

183-
def render_project_card(project: dict[str, Any]) -> str:
183+
def render_project_card(project: dict[str, Any], category_map: dict[str, str] | None = None) -> str:
184184
project_title = project.get("title", "Project")
185185
project_id = f"project-{slugify(project_title)}"
186186
modal_id = f"modal-{project_id}"
@@ -212,9 +212,13 @@ def render_project_card(project: dict[str, Any]) -> str:
212212

213213
date_html = ""
214214
if project.get("date"):
215+
category = project.get("category", "other")
216+
category_label = category_map.get(category) if category_map else None
217+
if not category_label:
218+
category_label = category.replace("-", " ").title()
215219
date_html = (
216220
'<span class="text-xs font-medium font-mono text-zinc-500 dark:text-zinc-400 mb-2 block flex items-center">'
217-
f'<ion-icon name="time-outline" class="mr-1"></ion-icon>{project["date"]}</span>'
221+
f'<ion-icon name="time-outline" class="mr-1"></ion-icon>{project["date"]} \u2022 {category_label}</span>'
218222
)
219223

220224
details_button_html = ""
@@ -393,6 +397,7 @@ def build_index_context(config: dict[str, Any]) -> dict[str, Any]:
393397
}
394398

395399
filters = config.get("project_filters") or default_project_filters(projects)
400+
category_map = {f["key"]: f["label"] for f in filters if "key" in f and "label" in f}
396401

397402
content = {
398403
"first_tagline": taglines[0],
@@ -406,7 +411,7 @@ def build_index_context(config: dict[str, Any]) -> dict[str, Any]:
406411
render_skill_item(skill, project_ids) for skill in skills.get("technologies", [])
407412
),
408413
"project_filters_html": render_filter_buttons(filters),
409-
"project_cards_html": "".join(render_project_card(project) for project in projects),
414+
"project_cards_html": "".join(render_project_card(project, category_map) for project in projects),
410415
"project_modals_html": "".join(render_project_modal(project) for project in projects),
411416
}
412417

0 commit comments

Comments
 (0)