feat: update interests templates for category-based data model

Interests are now grouped by category (matching skills pattern).
Updated cv-interests.njk to iterate categories, cv.js fallback to {},
and cv.njk hasCvData check to include interests.
This commit is contained in:
Ricardo
2026-02-25 14:56:11 +01:00
parent 116ac63f5f
commit ab31e080bb
3 changed files with 20 additions and 11 deletions

View File

@@ -30,7 +30,7 @@ export default function () {
skillTypes: {},
languages: [],
education: [],
interests: [],
interests: {},
interestTypes: {},
};
}

View File

@@ -1,21 +1,29 @@
{#
CV Interests Section - interest tags
CV Interests Section - interests grouped by category
Data fetched from /cv/data.json via homepage plugin
#}
{% if cv and cv.interests and cv.interests.length %}
{% if cv and cv.interests and (cv.interests | dictsort | length) %}
<section class="mb-8 sm:mb-12" id="interests">
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6">
{{ section.config.title or "Interests" }}
</h2>
{% set hasTypeData = cv.interestTypes and (cv.interestTypes | dictsort | length > 0) %}
<div class="flex flex-wrap gap-2">
{% for interest in cv.interests %}
{% if not filterType or (hasTypeData and cv.interestTypes[interest] == filterType) or not hasTypeData %}
<span class="px-3 py-1.5 bg-white dark:bg-surface-800 border border-surface-200 dark:border-surface-700 rounded-full text-sm text-surface-700 dark:text-surface-300 hover:border-primary-400 dark:hover:border-primary-600 transition-colors">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
{% for category, items in cv.interests | dictsort %}
{% if not filterType or (cv.interestTypes and cv.interestTypes[category] == filterType) or not cv.interestTypes or not cv.interestTypes[category] %}
<div class="p-4 bg-white dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700">
<h3 class="font-semibold text-sm uppercase tracking-wide text-surface-600 dark:text-surface-400 mb-2">
{{ category }}
</h3>
<div class="flex flex-wrap gap-1.5">
{% for interest in items %}
<span class="text-xs px-2 py-1 bg-primary-50 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300 rounded-full">
{{ interest }}
</span>
{% endfor %}
</div>
</div>
{% endif %}
{% endfor %}
</div>

3
cv.njk
View File

@@ -10,7 +10,8 @@ pagefindIgnore: true
{% set hasCvData = (cv.experience and cv.experience.length) or
(cv.projects and cv.projects.length) or
(cv.skills and ((cv.skills or {}) | dictsort | length)) %}
(cv.skills and ((cv.skills or {}) | dictsort | length)) or
(cv.interests and ((cv.interests or {}) | dictsort | length)) %}
{% if hasCvData %}