Files

40 lines
1.9 KiB
Plaintext

{# Fediverse Follow Me Widget — uses the fediverseInteract Alpine.js component #}
{# 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 socialLinks %}
{% if link.icon == "activitypub" and not actorUrl %}
{% set actorUrl = link.url %}
{% endif %}
{% endfor %}
{% if not actorUrl %}
{% for link in socialLinks %}
{% if link.icon == "mastodon" and not actorUrl %}
{% set actorUrl = link.url %}
{% endif %}
{% endfor %}
{% endif %}
{% if actorUrl %}
<is-land on:visible>
<div class="widget" x-data="fediverseInteract('{{ actorUrl }}', 'interact')">
<h3 class="widget-title">Follow Me</h3>
<p class="text-sm text-surface-600 dark:text-surface-400 mb-3">Follow me from your fediverse instance.</p>
<a href="{{ actorUrl }}"
@click="handleClick($event)"
class="inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-[#a730b8]/10 text-[#a730b8] hover:bg-[#a730b8]/20 transition-colors text-sm font-medium cursor-pointer"
aria-label="Follow on the Fediverse (use the modal to pick your instance)">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M13.09 4.43L24 10.73v2.51L13.09 19.58v-2.51L21.83 12 13.09 6.98v-2.55zM13.09 9.49L17.44 12l-4.35 2.51V9.49z"/><path d="M10.91 4.43L0 10.73v2.51l8.74-5.03v10.09l2.18 1.28V4.43zM6.56 12L2.18 14.51l4.35 2.51V12z"/></svg>
<span>Follow on the Fediverse</span>
</a>
{% set modalTitle = "Follow on the Fediverse" %}
{% set modalDescription = "Choose your instance to follow this account." %}
{% include "components/fediverse-modal.njk" %}
</div>
</is-land>
{% endif %}