diff --git a/_includes/components/h-card.njk b/_includes/components/h-card.njk index d5b9ade..366e725 100644 --- a/_includes/components/h-card.njk +++ b/_includes/components/h-card.njk @@ -5,20 +5,20 @@ Include in sidebar widgets, author cards, etc. #} {% set id = homepageConfig.identity if (homepageConfig and homepageConfig.identity) else {} %} -{% set authorName = id.name or site.author.name %} -{% set authorAvatar = id.avatar or site.author.avatar %} -{% set authorTitle = id.title or site.author.title %} -{% set authorBio = id.bio or site.author.bio %} -{% set authorUrl = id.url or site.author.url %} -{% set authorPronoun = id.pronoun or site.author.pronoun %} -{% set authorLocality = id.locality or site.author.locality %} -{% set authorCountry = id.country or site.author.country %} -{% set authorLocation = site.author.location %} -{% set authorOrg = id.org or site.author.org %} -{% set authorEmail = id.email or site.author.email %} -{% set authorKeyUrl = id.keyUrl or site.author.keyUrl %} -{% set authorCategories = id.categories if (id.categories and id.categories.length) else site.author.categories %} -{% set socialLinks = id.social if (id.social and id.social.length) else site.social %} +{% set authorName = id.name if (id.name is defined) else site.author.name %} +{% set authorAvatar = id.avatar if (id.avatar is defined) else site.author.avatar %} +{% set authorTitle = id.title if (id.title is defined) else site.author.title %} +{% set authorBio = id.bio if (id.bio is defined) else site.author.bio %} +{% set authorUrl = id.url if (id.url is defined and id.url) else site.author.url %} +{% set authorPronoun = id.pronoun if (id.pronoun is defined) else site.author.pronoun %} +{% set authorLocality = id.locality if (id.locality is defined) else site.author.locality %} +{% set authorCountry = id.country if (id.country is defined) else site.author.country %} +{% set authorLocation = id.location if (id.location is defined) else site.author.location %} +{% set authorOrg = id.org if (id.org is defined) else site.author.org %} +{% set authorEmail = id.email if (id.email is defined) else site.author.email %} +{% set authorKeyUrl = id.keyUrl if (id.keyUrl is defined) else site.author.keyUrl %} +{% set authorCategories = id.categories if (id.categories is defined) else site.author.categories %} +{% set socialLinks = id.social if (id.social is defined) else site.social %}
{# Hidden u-photo for reliable microformat parsing (some parsers struggle with img inside links) #} @@ -43,7 +43,9 @@ {% if authorPronoun %} ({{ authorPronoun }}) {% endif %} + {% if authorTitle %}

{{ authorTitle }}

+ {% endif %} {# Structured address #}

{% if authorLocality %} @@ -61,7 +63,9 @@

{# Bio #} + {% if authorBio %}

{{ authorBio }}

+ {% endif %} {# Organization #} {% if authorOrg %} diff --git a/_includes/components/widgets/author-card-compact.njk b/_includes/components/widgets/author-card-compact.njk index 855882b..e83710a 100644 --- a/_includes/components/widgets/author-card-compact.njk +++ b/_includes/components/widgets/author-card-compact.njk @@ -1,30 +1,43 @@ {# Author Compact Card - h-card microformat (compact version for blog sidebars) #} +{% set id = homepageConfig.identity if (homepageConfig and homepageConfig.identity) else {} %} +{% set authorName = id.name if (id.name is defined) else site.author.name %} +{% set authorAvatar = id.avatar if (id.avatar is defined) else site.author.avatar %} +{% set authorTitle = id.title if (id.title is defined) else site.author.title %} +{% set authorUrl = id.url if (id.url is defined and id.url) else site.author.url %} +{% set authorLocality = id.locality if (id.locality is defined) else site.author.locality %} +{% set authorCountry = id.country if (id.country is defined) else site.author.country %} +{% set authorBio = id.bio if (id.bio is defined) else site.author.bio %} +{% set authorEmail = id.email if (id.email is defined) else site.author.email %} +{% set authorOrg = id.org if (id.org is defined) else site.author.org %} +
{# Hidden u-photo for reliable microformat parsing #} - -
- - {{ site.author.name }} + + {{ authorName }} -

{{ site.author.title }}

- {% if site.author.locality %} -

{{ site.author.locality }}{% if site.author.country %}, {{ site.author.country }}{% endif %}

+ {% if authorTitle %} +

{{ authorTitle }}

+ {% endif %} + {% if authorLocality %} +

{{ authorLocality }}{% if authorCountry %}, {{ authorCountry }}{% endif %}

{% endif %}
{# Hidden but present for microformat completeness #} - - {% if site.author.email %}{% endif %} - {% if site.author.org %}{% endif %} + {% if authorBio %}{% endif %} + {% if authorEmail %}{% endif %} + {% if authorOrg %}{% endif %}
diff --git a/_includes/components/widgets/fediverse-follow.njk b/_includes/components/widgets/fediverse-follow.njk index 66ac2f1..f27a5f8 100644 --- a/_includes/components/widgets/fediverse-follow.njk +++ b/_includes/components/widgets/fediverse-follow.njk @@ -2,14 +2,17 @@ {# Requires fediverse-interact.js loaded in base.njk (already present) #} {# Determines actor URI from site social links: prefers self-hosted AP, falls back to Mastodon #} +{% set id = homepageConfig.identity if (homepageConfig and homepageConfig.identity) else {} %} +{% set socialLinks = id.social if (id.social is defined) else site.social %} + {% set actorUrl = "" %} -{% for link in site.social %} +{% for link in socialLinks %} {% if link.icon == "activitypub" and not actorUrl %} {% set actorUrl = link.url %} {% endif %} {% endfor %} {% if not actorUrl %} - {% for link in site.social %} + {% for link in socialLinks %} {% if link.icon == "mastodon" and not actorUrl %} {% set actorUrl = link.url %} {% endif %} diff --git a/_includes/components/widgets/github-repos.njk b/_includes/components/widgets/github-repos.njk index 3fd7b46..4f7fa0c 100644 --- a/_includes/components/widgets/github-repos.njk +++ b/_includes/components/widgets/github-repos.njk @@ -4,7 +4,18 @@ {% set ghFallbackFeatured = githubActivity.featured if githubActivity and githubActivity.featured else [] %} {% set ghFallbackContributions = githubActivity.contributions if githubActivity and githubActivity.contributions else [] %} {% set ghFallbackRepos = githubRepos if githubRepos else [] %} -
+{% set id = homepageConfig.identity if (homepageConfig and homepageConfig.identity) else {} %} +{% set socialLinks = id.social if (id.social is defined) else site.social %} +{% set githubProfileUrl = "" %} +{% for link in socialLinks %} + {% if not githubProfileUrl and (link.icon == "github" or "github.com/" in link.url) %} + {% set githubProfileUrl = link.url %} + {% endif %} +{% endfor %} +{% if not githubProfileUrl and site.feeds.github %} + {% set githubProfileUrl = "https://github.com/" + site.feeds.github %} +{% endif %} +

{# Footer link #} - {% if site.feeds.github %} - + {% if githubProfileUrl %} + View on GitHub @@ -179,7 +190,7 @@ const githubFallbackData = { repos: {{ ghFallbackRepos | dump | safe }}, }; -function githubWidget(username) { +function githubWidget(username, profileUrl) { return { activeTab: 'commits', loading: true, @@ -199,6 +210,12 @@ function githubWidget(username) { return firstRepo.includes('/') ? firstRepo.split('/')[0] : ''; }, + deriveUsernameFromProfile(url) { + if (!url || typeof url !== 'string') return ''; + const match = url.match(/github\.com\/([^/?#]+)/i); + return match ? match[1] : ''; + }, + async fetchJson(paths) { for (const path of paths) { try { @@ -270,7 +287,10 @@ function githubWidget(username) { this.contributions = contribRes.data?.contributions || []; } - let resolvedUsername = username; + let resolvedUsername = this.deriveUsernameFromProfile(profileUrl); + if (!resolvedUsername) { + resolvedUsername = username; + } if (!resolvedUsername) { resolvedUsername = this.deriveUsernameFromCommits(this.commits); } diff --git a/_includes/components/widgets/social-activity.njk b/_includes/components/widgets/social-activity.njk index c545548..9142ec2 100644 --- a/_includes/components/widgets/social-activity.njk +++ b/_includes/components/widgets/social-activity.njk @@ -1,5 +1,25 @@ {# Social Feed Widget - Tabbed Bluesky/Mastodon #} {% if (blueskyFeed and blueskyFeed.length) or (mastodonFeed and mastodonFeed.length) %} +{% set id = homepageConfig.identity if (homepageConfig and homepageConfig.identity) else {} %} +{% set socialLinks = id.social if (id.social is defined) else site.social %} + +{% set blueskyProfileUrl = "" %} +{% set mastodonProfileUrl = "" %} +{% for link in socialLinks %} + {% if not blueskyProfileUrl and (link.icon == "bluesky" or "bsky.app/profile/" in link.url) %} + {% set blueskyProfileUrl = link.url %} + {% endif %} + {% if not mastodonProfileUrl and (link.icon == "mastodon" or "@" in link.url) %} + {% set mastodonProfileUrl = link.url %} + {% endif %} +{% endfor %} +{% if not blueskyProfileUrl and site.feeds.bluesky %} + {% set blueskyProfileUrl = "https://bsky.app/profile/" + site.feeds.bluesky %} +{% endif %} +{% if not mastodonProfileUrl and site.feeds.mastodon.instance and site.feeds.mastodon.username %} + {% set mastodonProfileUrl = "https://" + site.feeds.mastodon.instance + "/@" + site.feeds.mastodon.username %} +{% endif %} + {% set defaultSocialTab = "mastodon" if mastodonFeed and mastodonFeed.length else "bluesky" %}
@@ -60,10 +80,12 @@ {% endfor %} - + {% if blueskyProfileUrl %} + View on Bluesky + {% endif %}
{% endif %} @@ -90,10 +112,12 @@ {% endfor %} - + {% if mastodonProfileUrl %} + View on Mastodon + {% endif %}
{% endif %} diff --git a/theme/_includes/components/h-card.njk b/theme/_includes/components/h-card.njk index 8e1dc83..dd1d4a7 100644 --- a/theme/_includes/components/h-card.njk +++ b/theme/_includes/components/h-card.njk @@ -5,20 +5,20 @@ Include in sidebar widgets, author cards, etc. #} {% set id = homepageConfig.identity if (homepageConfig and homepageConfig.identity) else {} %} -{% set authorName = id.name or site.author.name %} -{% set authorAvatar = id.avatar or site.author.avatar %} -{% set authorTitle = id.title or site.author.title %} -{% set authorBio = id.bio or site.author.bio %} -{% set authorUrl = id.url or site.author.url %} -{% set authorPronoun = id.pronoun or site.author.pronoun %} -{% set authorLocality = id.locality or site.author.locality %} -{% set authorCountry = id.country or site.author.country %} -{% set authorLocation = site.author.location %} -{% set authorOrg = id.org or site.author.org %} -{% set authorEmail = id.email or site.author.email %} -{% set authorKeyUrl = id.keyUrl or site.author.keyUrl %} -{% set authorCategories = id.categories if (id.categories and id.categories.length) else site.author.categories %} -{% set socialLinks = id.social if (id.social and id.social.length) else site.social %} +{% set authorName = id.name if (id.name is defined) else site.author.name %} +{% set authorAvatar = id.avatar if (id.avatar is defined) else site.author.avatar %} +{% set authorTitle = id.title if (id.title is defined) else site.author.title %} +{% set authorBio = id.bio if (id.bio is defined) else site.author.bio %} +{% set authorUrl = id.url if (id.url is defined and id.url) else site.author.url %} +{% set authorPronoun = id.pronoun if (id.pronoun is defined) else site.author.pronoun %} +{% set authorLocality = id.locality if (id.locality is defined) else site.author.locality %} +{% set authorCountry = id.country if (id.country is defined) else site.author.country %} +{% set authorLocation = id.location if (id.location is defined) else site.author.location %} +{% set authorOrg = id.org if (id.org is defined) else site.author.org %} +{% set authorEmail = id.email if (id.email is defined) else site.author.email %} +{% set authorKeyUrl = id.keyUrl if (id.keyUrl is defined) else site.author.keyUrl %} +{% set authorCategories = id.categories if (id.categories is defined) else site.author.categories %} +{% set socialLinks = id.social if (id.social is defined) else site.social %}
{# Hidden u-photo for reliable microformat parsing (some parsers struggle with img inside links) #} @@ -41,7 +41,9 @@ {% if authorPronoun %} ({{ authorPronoun }}) {% endif %} + {% if authorTitle %}

{{ authorTitle }}

+ {% endif %} {# Structured address #}

{% if authorLocality %} @@ -59,7 +61,9 @@

{# Bio #} + {% if authorBio %}

{{ authorBio }}

+ {% endif %} {# Organization #} {% if authorOrg %} diff --git a/theme/_includes/components/widgets/author-card-compact.njk b/theme/_includes/components/widgets/author-card-compact.njk index b139b66..f213550 100644 --- a/theme/_includes/components/widgets/author-card-compact.njk +++ b/theme/_includes/components/widgets/author-card-compact.njk @@ -1,30 +1,43 @@ {# Author Compact Card - h-card microformat (compact version for blog sidebars) #} +{% set id = homepageConfig.identity if (homepageConfig and homepageConfig.identity) else {} %} +{% set authorName = id.name if (id.name is defined) else site.author.name %} +{% set authorAvatar = id.avatar if (id.avatar is defined) else site.author.avatar %} +{% set authorTitle = id.title if (id.title is defined) else site.author.title %} +{% set authorUrl = id.url if (id.url is defined and id.url) else site.author.url %} +{% set authorLocality = id.locality if (id.locality is defined) else site.author.locality %} +{% set authorCountry = id.country if (id.country is defined) else site.author.country %} +{% set authorBio = id.bio if (id.bio is defined) else site.author.bio %} +{% set authorEmail = id.email if (id.email is defined) else site.author.email %} +{% set authorOrg = id.org if (id.org is defined) else site.author.org %} +
{# Hidden u-photo for reliable microformat parsing #} - -
- - {{ site.author.name }} + + {{ authorName }} -

{{ site.author.title }}

- {% if site.author.locality %} -

{{ site.author.locality }}{% if site.author.country %}, {{ site.author.country }}{% endif %}

+ {% if authorTitle %} +

{{ authorTitle }}

+ {% endif %} + {% if authorLocality %} +

{{ authorLocality }}{% if authorCountry %}, {{ authorCountry }}{% endif %}

{% endif %}
{# Hidden but present for microformat completeness #} - - {% if site.author.email %}{% endif %} - {% if site.author.org %}{% endif %} + {% if authorBio %}{% endif %} + {% if authorEmail %}{% endif %} + {% if authorOrg %}{% endif %}
diff --git a/theme/_includes/components/widgets/fediverse-follow.njk b/theme/_includes/components/widgets/fediverse-follow.njk index 10d081f..b99dbb3 100644 --- a/theme/_includes/components/widgets/fediverse-follow.njk +++ b/theme/_includes/components/widgets/fediverse-follow.njk @@ -2,14 +2,17 @@ {# Requires fediverse-interact.js loaded in base.njk (already present) #} {# Determines actor URI from site social links: prefers self-hosted AP, falls back to Mastodon #} +{% set id = homepageConfig.identity if (homepageConfig and homepageConfig.identity) else {} %} +{% set socialLinks = id.social if (id.social is defined) else site.social %} + {% set actorUrl = "" %} -{% for link in site.social %} +{% for link in socialLinks %} {% if link.icon == "activitypub" and not actorUrl %} {% set actorUrl = link.url %} {% endif %} {% endfor %} {% if not actorUrl %} - {% for link in site.social %} + {% for link in socialLinks %} {% if link.icon == "mastodon" and not actorUrl %} {% set actorUrl = link.url %} {% endif %} diff --git a/theme/_includes/components/widgets/github-repos.njk b/theme/_includes/components/widgets/github-repos.njk index c42a6b8..69c46be 100644 --- a/theme/_includes/components/widgets/github-repos.njk +++ b/theme/_includes/components/widgets/github-repos.njk @@ -4,7 +4,18 @@ {% set ghFallbackFeatured = githubActivity.featured if githubActivity and githubActivity.featured else [] %} {% set ghFallbackContributions = githubActivity.contributions if githubActivity and githubActivity.contributions else [] %} {% set ghFallbackRepos = githubRepos if githubRepos else [] %} -
+{% set id = homepageConfig.identity if (homepageConfig and homepageConfig.identity) else {} %} +{% set socialLinks = id.social if (id.social is defined) else site.social %} +{% set githubProfileUrl = "" %} +{% for link in socialLinks %} + {% if not githubProfileUrl and (link.icon == "github" or "github.com/" in link.url) %} + {% set githubProfileUrl = link.url %} + {% endif %} +{% endfor %} +{% if not githubProfileUrl and site.feeds.github %} + {% set githubProfileUrl = "https://github.com/" + site.feeds.github %} +{% endif %} +

{# Footer link #} - {% if site.feeds.github %} - + {% if githubProfileUrl %} + View on GitHub @@ -171,7 +182,7 @@ const githubFallbackData = { repos: {{ ghFallbackRepos | dump | safe }}, }; -function githubWidget(username) { +function githubWidget(username, profileUrl) { return { activeTab: 'commits', loading: true, @@ -191,6 +202,12 @@ function githubWidget(username) { return firstRepo.includes('/') ? firstRepo.split('/')[0] : ''; }, + deriveUsernameFromProfile(url) { + if (!url || typeof url !== 'string') return ''; + const match = url.match(/github\.com\/([^/?#]+)/i); + return match ? match[1] : ''; + }, + async fetchJson(paths) { for (const path of paths) { try { @@ -262,7 +279,10 @@ function githubWidget(username) { this.contributions = contribRes.data?.contributions || []; } - let resolvedUsername = username; + let resolvedUsername = this.deriveUsernameFromProfile(profileUrl); + if (!resolvedUsername) { + resolvedUsername = username; + } if (!resolvedUsername) { resolvedUsername = this.deriveUsernameFromCommits(this.commits); } diff --git a/theme/_includes/components/widgets/social-activity.njk b/theme/_includes/components/widgets/social-activity.njk index df1987c..e6a2e69 100644 --- a/theme/_includes/components/widgets/social-activity.njk +++ b/theme/_includes/components/widgets/social-activity.njk @@ -1,5 +1,25 @@ {# Social Feed Widget - Tabbed Bluesky/Mastodon #} {% if (blueskyFeed and blueskyFeed.length) or (mastodonFeed and mastodonFeed.length) %} +{% set id = homepageConfig.identity if (homepageConfig and homepageConfig.identity) else {} %} +{% set socialLinks = id.social if (id.social is defined) else site.social %} + +{% set blueskyProfileUrl = "" %} +{% set mastodonProfileUrl = "" %} +{% for link in socialLinks %} + {% if not blueskyProfileUrl and (link.icon == "bluesky" or "bsky.app/profile/" in link.url) %} + {% set blueskyProfileUrl = link.url %} + {% endif %} + {% if not mastodonProfileUrl and (link.icon == "mastodon" or "@" in link.url) %} + {% set mastodonProfileUrl = link.url %} + {% endif %} +{% endfor %} +{% if not blueskyProfileUrl and site.feeds.bluesky %} + {% set blueskyProfileUrl = "https://bsky.app/profile/" + site.feeds.bluesky %} +{% endif %} +{% if not mastodonProfileUrl and site.feeds.mastodon.instance and site.feeds.mastodon.username %} + {% set mastodonProfileUrl = "https://" + site.feeds.mastodon.instance + "/@" + site.feeds.mastodon.username %} +{% endif %} + {% set defaultSocialTab = "mastodon" if mastodonFeed and mastodonFeed.length else "bluesky" %}
@@ -56,10 +76,12 @@ {% endfor %} - + {% if blueskyProfileUrl %} + View on Bluesky + {% endif %}
{% endif %} @@ -86,10 +108,12 @@ {% endfor %} - + {% if mastodonProfileUrl %} + View on Mastodon + {% endif %}
{% endif %}