Class: Jekyll::RpLogs::TagIndex

Inherits:
Page
  • Object
show all
Defined in:
lib/jekyll/rp_logs/rp_tag_index.rb

Instance Method Summary collapse

Constructor Details

#initialize(site, base, dir, tag, pages) ⇒ TagIndex

Returns a new instance of TagIndex.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jekyll/rp_logs/rp_tag_index.rb', line 6

def initialize(site, base, dir, tag, pages)
  @site = site
  @base = base
  @dir = dir
  @name = "index.html"

  process(@name)
  # Get tag_index filename
  tag_index = (site.config["rp_tag_index_layout"] || "tag_index") + ".html"
  read_yaml(File.join(base, "_layouts"), tag_index)
  data["tag"] = tag # Set which tag this index is for
  data["description"] = site.config["tag_descriptions"][tag.to_s]

  # Sort tagged RPs by their start date
  data["pages"] = pages.sort_by { |p| p.data["start_date"] }
  tag_title_prefix = site.config["rp_tag_title_prefix"] || "Tag: "
  data["title"] = "#{tag_title_prefix}#{tag.name}"
end