mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
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:
@@ -30,7 +30,7 @@ export default function () {
|
||||
skillTypes: {},
|
||||
languages: [],
|
||||
education: [],
|
||||
interests: [],
|
||||
interests: {},
|
||||
interestTypes: {},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
{{ interest }}
|
||||
</span>
|
||||
<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
3
cv.njk
@@ -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 %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user