Class: Jekyll::LinkedPosts

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/linked_posts.rb

Overview

Link posts by a field value, ideally an UUID

Constant Summary collapse

FIELDS =

Default linked fields

%w[lang related].freeze
INDEXABLE_TYPES =

Value types allowed to index by

[String, Integer].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ LinkedPosts

Returns a new instance of LinkedPosts.



13
14
15
# File 'lib/jekyll/linked_posts.rb', line 13

def initialize(site)
  @site = site
end

Instance Attribute Details

#siteObject (readonly)

Returns the value of attribute site.



11
12
13
# File 'lib/jekyll/linked_posts.rb', line 11

def site
  @site
end

Instance Method Details

#readObject

Process all the documents from the site and replace the UUID for the actual post.

If it doesn’t find anything it’ll show a warning and replace the value for nil.



22
23
24
25
26
# File 'lib/jekyll/linked_posts.rb', line 22

def read
  indexable_documents.each do |doc|
    process doc
  end
end