Class: Jekyll::ActivityPub::WebFinger
- Inherits:
-
Page
- Object
- Page
- Jekyll::ActivityPub::WebFinger
- Includes:
- Helper
- Defined in:
- lib/jekyll/activity_pub/webfinger.rb
Overview
Points to site’s author
Instance Method Summary collapse
-
#initialize(site, actor, base = '', dir = '.well-known', name = 'webfinger') ⇒ WebFinger
constructor
Initialize with default data.
-
#permalink ⇒ String
The webfinger file is expected to be at this location always.
- #read_yaml ⇒ Object
Methods included from Helper
#content, #generate_excerpt?, #hook_owner, #locale, #place_in_layout?, #pruned_data, #render_with_liquid?, #to_json, #to_liquid, #trigger_hooks
Constructor Details
#initialize(site, actor, base = '', dir = '.well-known', name = 'webfinger') ⇒ WebFinger
Initialize with default data
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jekyll/activity_pub/webfinger.rb', line 19 def initialize(site, actor, base = '', dir = '.well-known', name = 'webfinger') @context = StubContext.new(registers: { site: site }) @actor = actor super(site, base, dir, name) # Set the actor profile in yet another format (no leading @) site.config['activity_pub_profile'] = "#{username}@#{hostname}" trigger_hooks :post_init end |
Instance Method Details
#permalink ⇒ String
The webfinger file is expected to be at this location always
62 63 64 |
# File 'lib/jekyll/activity_pub/webfinger.rb', line 62 def permalink '.well-known/webfinger' end |
#read_yaml ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/jekyll/activity_pub/webfinger.rb', line 31 def read_yaml(*) self.data = { 'subject' => "acct:#{username}@#{hostname}", 'aliases' => [], 'links' => [ { 'rel' => 'self', 'type' => 'application/activity+json', 'href' => absolute_url(@actor.url) }, { 'rel' => 'http://webfinger.net/rel/profile-page', 'type' => 'text/html', 'href' => site.config['url'] } ] }.tap do |data| next unless @actor.data['icon'] data['links'] << { 'rel' => 'http://webfinger.net/rel/avatar', 'type' => @actor.data.dig('icon', 'mediaType'), 'href' => @actor.data.dig('icon', 'url') } end end |