fix: show untyped CV items in both work and personal views

Items without a type field (existing data before type feature was added)
were only appearing in "personal" filtered views. Since the /cv/ page uses
work-only variants, all existing untyped data was hidden. Changed filtering
so untyped items appear in both work and personal views.

Also guard cv.skills dictsort in cv.njk against undefined.
This commit is contained in:
Ricardo
2026-02-20 13:55:52 +01:00
parent f2cc855f3d
commit a54600b003
5 changed files with 5 additions and 5 deletions

View File

@@ -15,7 +15,7 @@
{% if hasEducation %} {% if hasEducation %}
<div class="space-y-3 mb-6"> <div class="space-y-3 mb-6">
{% for item in cv.education %} {% for item in cv.education %}
{% if not filterType or item.educationType == filterType or (filterType == "personal" and not item.educationType) %} {% if not filterType or item.educationType == filterType or not item.educationType %}
<div class="p-4 bg-white dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700"> <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-surface-900 dark:text-surface-100">{{ item.degree }}</h3> <h3 class="font-semibold text-surface-900 dark:text-surface-100">{{ item.degree }}</h3>
<p class="text-sm text-surface-600 dark:text-surface-400"> <p class="text-sm text-surface-600 dark:text-surface-400">

View File

@@ -15,7 +15,7 @@
<div class="space-y-4"> <div class="space-y-4">
{% for item in cv.experience | head(maxItems) %} {% for item in cv.experience | head(maxItems) %}
{% if not filterType or item.experienceType == filterType or (filterType == "personal" and not item.experienceType) %} {% if not filterType or item.experienceType == filterType or not item.experienceType %}
<div class="relative pl-6 border-l-2 border-primary-300 dark:border-primary-700"> <div class="relative pl-6 border-l-2 border-primary-300 dark:border-primary-700">
<div class="absolute -left-[7px] top-1 w-3 h-3 rounded-full bg-primary-500"></div> <div class="absolute -left-[7px] top-1 w-3 h-3 rounded-full bg-primary-500"></div>
<h3 class="font-semibold text-surface-900 dark:text-surface-100">{{ item.title }}</h3> <h3 class="font-semibold text-surface-900 dark:text-surface-100">{{ item.title }}</h3>

View File

@@ -11,7 +11,7 @@
<div class="flex flex-wrap gap-2"> <div class="flex flex-wrap gap-2">
{% for interest in cv.interests %} {% for interest in cv.interests %}
{% if not filterType or (cv.interestTypes and cv.interestTypes[interest] == filterType) or (filterType == "personal" and (not cv.interestTypes or not cv.interestTypes[interest])) %} {% if not filterType or (cv.interestTypes and cv.interestTypes[interest] == filterType) or not cv.interestTypes or not cv.interestTypes[interest] %}
<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"> <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 }} {{ interest }}
</span> </span>

View File

@@ -11,7 +11,7 @@
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4"> <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
{% for category, items in cv.skills | dictsort %} {% for category, items in cv.skills | dictsort %}
{% if not filterType or (cv.skillTypes and cv.skillTypes[category] == filterType) or (filterType == "personal" and (not cv.skillTypes or not cv.skillTypes[category])) %} {% if not filterType or (cv.skillTypes and cv.skillTypes[category] == filterType) or not cv.skillTypes or not cv.skillTypes[category] %}
<div class="p-4 bg-white dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700"> <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"> <h3 class="font-semibold text-sm uppercase tracking-wide text-surface-600 dark:text-surface-400 mb-2">
{{ category }} {{ category }}

2
cv.njk
View File

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