Module: Abqari::Indieweb::Bridgy

Defined in:
lib/abqari/indieweb.rb

Overview

Bridgy Fed + webmention.io link tags. Pure markup — no runtime logic. Layouts call these from <head> via the _head partial.

Bridgy Fed (fed.brid.gy) acts as the ActivityPub bridge: it speaks the federation protocol on the site's behalf and translates incoming AP activity into webmentions, which webmention.io catches for us. Net result: a Mastodon user can search @<your-domain> and follow the site directly, with their replies showing up under posts as ordinary webmentions.

Class Method Summary collapse

Class Method Details



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/abqari/indieweb.rb', line 523

def self.head_links(site)
  cfg = Indieweb.config_for(site)
  return [] unless Indieweb.enabled?(site)

  links = []
  # Webmention endpoint discovery — sites that link to ours can
  # ping this URL; webmention.io receives on our behalf.
  if (endpoint = Indieweb.webmention_endpoint(site))
    links << %(<link rel="webmention" href="#{endpoint}">)
    # Pingback for legacy interop. Free side-effect of having
    # webmention.io as the inbox.
    links << %(<link rel="pingback" href="https://webmention.io/webmention?forward=#{endpoint}">)
  end

  if cfg['bridgy_fed'] == true
    # Bridgy Fed exposes an AP actor at /ap/<domain>; advertising
    # the URL via `rel="me"` is enough for Mastodon's user lookup
    # to find the site. The site's own URL appearing as rel=me
    # on the Bridgy actor (set up out-of-band) closes the loop.
    domain = cfg['domain']
    links << %(<link rel="me" href="https://fed.brid.gy/r/https://#{domain}/">)
    links << %(<link rel="alternate" type="application/activity+json" )
    links[-1] += %(href="https://fed.brid.gy/r/https://#{domain}/">)
  end
  links
end