From f37cd3b913542be7a0d293d5411abe7a6ebc334e Mon Sep 17 00:00:00 2001 From: Ricardo Date: Fri, 6 Feb 2026 08:34:49 +0100 Subject: [PATCH] refactor: use h-card.njk component in sidebar, update homepage intro - Sidebar now includes h-card.njk instead of duplicating the code - Updated h-card.njk with hidden u-photo and full social links - Homepage hero: replace duplicate bio with unique intro text + Read more link - Net reduction of ~100 lines by proper component reuse Co-Authored-By: Claude Opus 4.5 --- _includes/components/h-card.njk | 120 +++++++++++++++---------------- _includes/components/sidebar.njk | 102 +------------------------- _includes/layouts/home.njk | 6 +- 3 files changed, 65 insertions(+), 163 deletions(-) diff --git a/_includes/components/h-card.njk b/_includes/components/h-card.njk index 73fccaf..bebdc9b 100644 --- a/_includes/components/h-card.njk +++ b/_includes/components/h-card.njk @@ -1,90 +1,83 @@ {# h-card - IndieWeb identity microformat #} {# See: https://microformats.org/wiki/h-card #} +{# + This is the canonical h-card component for the site. + Include in sidebar widgets, author cards, etc. +#}
- {# Avatar - visible for h-card validation #} - + {# Hidden u-photo for reliable microformat parsing (some parsers struggle with img inside links) #} + - {# Name #} - - {{ site.author.name }} - +
+ +
+ + {{ site.author.name }} + + {% if site.author.pronoun %} + ({{ site.author.pronoun }}) + {% endif %} +

{{ site.author.title }}

+ {# Structured address #} +

+ {% if site.author.locality %} + {{ site.author.locality }}{% if site.author.country %}, {% endif %} + {% endif %} + {% if site.author.country %} + {{ site.author.country }} + {% endif %} + {# Fallback to legacy location field #} + {% if not site.author.locality and site.author.location %} + {{ site.author.location }} + {% endif %} +

+
+
- {# Pronouns #} - {% if site.author.pronoun %} - ({{ site.author.pronoun }}) - {% endif %} - - {# Job title #} - {% if site.author.title %} - - {{ site.author.title }} - - {% endif %} + {# Bio #} +

{{ site.author.bio }}

{# Organization #} {% if site.author.org %} - - @ {{ site.author.org }} - - {% endif %} - - {# Bio / Note #} - {% if site.author.bio %} -

- {{ site.author.bio }} +

+ {{ site.author.org }}

{% endif %} - {# Location - structured address #} -
- {% if site.author.locality %} - {{ site.author.locality }}{% if site.author.region or site.author.country %}, {% endif %} + {# Email and PGP Key #} +
+ {% if site.author.email %} + + ✉️ {{ site.author.email }} + {% endif %} - {% if site.author.region %} - {{ site.author.region }}{% if site.author.country %}, {% endif %} - {% endif %} - {% if site.author.country %} - {{ site.author.country }} - {% endif %} - {# Fallback to legacy location field if structured fields not set #} - {% if not site.author.locality and not site.author.region and not site.author.country and site.author.location %} - {{ site.author.location }} + {% if site.author.keyUrl %} + + 🔐 PGP Key + {% endif %}
- {# Email #} - {% if site.author.email %} - - {{ site.author.email }} - - {% endif %} - - {# PGP Key #} - {% if site.author.keyUrl %} - - 🔐 PGP Key - - {% endif %} - {# Categories / Skills #} {% if site.author.categories and site.author.categories.length %} -
+
{% for category in site.author.categories %} {{ category }} {% endfor %}
{% endif %} - {# Social links with rel="me" #} + {# Social links with rel="me" - critical for IndieWeb identity verification #} + {% if site.social and site.social.length %} + {% endif %}
diff --git a/_includes/components/sidebar.njk b/_includes/components/sidebar.njk index 602b68b..ac40f39 100644 --- a/_includes/components/sidebar.njk +++ b/_includes/components/sidebar.njk @@ -1,105 +1,9 @@ {# Sidebar Components #} -{# Contains: Author card, Bluesky feed, GitHub repos, RSS feed #} +{# Contains: Author card (via h-card component), Bluesky feed, GitHub repos, RSS feed #} -{# Author Card Widget - Full h-card microformat #} +{# Author Card Widget - includes the canonical h-card component #}
-
- {# Hidden u-photo for reliable microformat parsing (some parsers struggle with img inside links) #} - -
- -
- - {{ site.author.name }} - - {% if site.author.pronoun %} - ({{ site.author.pronoun }}) - {% endif %} -

{{ site.author.title }}

- {# Structured address #} -

- {% if site.author.locality %} - {{ site.author.locality }}{% if site.author.country %}, {% endif %} - {% endif %} - {% if site.author.country %} - {{ site.author.country }} - {% endif %} - {# Fallback to legacy location #} - {% if not site.author.locality and site.author.location %} - {{ site.author.location }} - {% endif %} -

-
-
- {# Bio #} -

{{ site.author.bio }}

- {# Organization #} - {% if site.author.org %} -

- {{ site.author.org }} -

- {% endif %} - {# Email and PGP Key #} -
- {% if site.author.email %} - - ✉️ {{ site.author.email }} - - {% endif %} - {% if site.author.keyUrl %} - - 🔐 PGP Key - - {% endif %} -
- {# Categories / Skills #} - {% if site.author.categories and site.author.categories.length %} -
- {% for category in site.author.categories %} - {{ category }} - {% endfor %} -
- {% endif %} - {# Social links with rel="me" - critical for IndieWeb identity verification #} - {% if site.social and site.social.length %} - - {% endif %} -
+ {% include "components/h-card.njk" %}
{# Social Feed Widget - Tabbed Bluesky/Mastodon #} diff --git a/_includes/layouts/home.njk b/_includes/layouts/home.njk index 1bbff60..73534c3 100644 --- a/_includes/layouts/home.njk +++ b/_includes/layouts/home.njk @@ -22,8 +22,12 @@ withSidebar: true

{{ site.author.title }}

+

+ Hi, I geek around tech, information systems, democracy, justice, coercive groups (aka cults), and discernment. +

- {{ site.author.bio }} + My blog serves as a repository for my thoughts, long-form writings (some still in draft), and a place where I bookmark interesting finds from the web. It's also my central hub for cross-posting to networks like Mastodon, Bluesky. + Read more →

{# Social Links #}