Module: Abqari::Indieweb

Defined in:
lib/abqari/indieweb.rb

Overview

IndieWeb foundation — Milestone A.

Three pieces, each independently useful:

1. Webmentions::Fetcher — polls webmention.io at build time, caches
 the result, exposes a per-URL lookup so the post layout can
 render replies/likes/reposts under each post.

2. Webmentions::Sender — POSTs notifications to external sites that
 our posts link to. Tracks what's been sent in a YAML log so
 re-builds don't spam. Off by default; opt in with
 `indieweb.send_webmentions: true`.

3. Bridgy — generates the `<link>` tags that announce the site to
 Bridgy Fed (Fediverse / ActivityPub bridge) and webmention.io.
 Tags only — no runtime federation logic here; Bridgy Fed handles
 the signed-HTTP/AP plumbing on its own infrastructure.

Config (indieweb: block in config/site.yml):

indieweb:
  enabled: true                       # master switch (default false)
  domain: example.com                  # required when enabled
  webmention_io_token: "..."           # optional — needed for receive
  bridgy_fed: true                     # adds Bridgy Fed link tags
  send_webmentions: true               # POST to targets on build
  send_window_days: 30                 # only send for posts published
                                       #   within the last N days

Cache: vendor/webmentions/ (gitignored, like vendor/folio/) — one file for received mentions, one for sent-log tracking.

Defined Under Namespace

Modules: Bridgy Classes: Fetcher, Sender

Constant Summary collapse

USER_AGENT =
"abqari-indieweb/#{Abqari::VERSION}"

Class Method Summary collapse

Class Method Details

.config_for(site) ⇒ Object



46
47
48
# File 'lib/abqari/indieweb.rb', line 46

def self.config_for(site)
  site.config['indieweb'] || {}
end

.enabled?(site) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
53
# File 'lib/abqari/indieweb.rb', line 50

def self.enabled?(site)
  cfg = config_for(site)
  cfg['enabled'] == true && !cfg['domain'].to_s.empty?
end

.webmention_endpoint(site) ⇒ Object

Convenience: site.indieweb returns this module, keeping the public API symmetrical with site.folio.



57
58
59
60
61
# File 'lib/abqari/indieweb.rb', line 57

def self.webmention_endpoint(site)
  cfg = config_for(site)
  return nil unless cfg['domain']
  "https://webmention.io/#{cfg['domain']}/webmention"
end