Class: Jekyll::ActivityPub::Actor

Inherits:
Page
  • Object
show all
Includes:
Helper
Defined in:
lib/jekyll/activity_pub/actor.rb

Overview

Points to site’s author profile

Instance Method Summary collapse

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, base = '', dir = '', name = 'about.jsonld') ⇒ Actor

Initialize with default data

Parameters:

  • :site (Jekyll::Site)
  • :base (String)
  • :dir (String)
  • :name (String)


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/jekyll/activity_pub/actor.rb', line 22

def initialize(site, base = '', dir = '', name = 'about.jsonld')
  @context = StubContext.new(registers: { site: site })
  super

  Notifier.actor_url = data['id']
  Notifier.actor = "@#{username}@#{hostname}"

  data['followers'] = Notifier.followers_url

  trigger_hooks :post_init
end

Instance Method Details

#dateTime

Returns:

  • (Time)


70
71
72
# File 'lib/jekyll/activity_pub/actor.rb', line 70

def date
  published
end

#read_yamlObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/jekyll/activity_pub/actor.rb', line 34

def read_yaml(*)
  self.data = {
    '@context' => [
      'https://www.w3.org/ns/activitystreams',
      'https://w3id.org/security/v1',
      {
        '@language' => locale,
        'schema' => 'http://schema.org#',
        'PropertyValue' => 'schema:PropertyValue',
        'value' => 'schema:value',
        'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
      }
    ],
    'type' => 'Person',
    'id' => absolute_url(url),
    'url' => site.config['url'],
    'outbox' => nil,
    'inbox' => inbox,
    'following' => nil,
    'followers' => nil,
    'preferredUsername' => username,
    'name' => public_name,
    'summary' => summary,
    'icon' => icons.first,
    'image' => images.first,
    'publicKey' => nil,
    'published' => published.xmlschema,
    'updated' => updated.xmlschema,
    'manuallyApprovesFollowers' => manually_approves_followers?,
    'attachment' => [
      PropertyValue.new(website_name, website_link)
    ]
  }
end