-
Notifications
You must be signed in to change notification settings - Fork 0
/
tagging.rb
35 lines (29 loc) · 856 Bytes
/
tagging.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'lib/tagging_extra'
require 'lib/paginate'
module Tagging
include TaggingExtra
# Creates in-memory tag pages
def create_tag_pages
tag_set(items).each do |tag|
page_identifier = @config[:tags][:page] % tag
next unless item_by_identifier(page_identifier).nil?
item = Nanoc3::Item.new(
# content
@config[:tags][:content],
# do not include in sitemap.xml
{ :title => @config[:tags][:title] % tag,
:tag => tag,
:page_size => 10,
:kind => 'tag'
}.merge(@config[:tags][:attributes]),
# identifier
page_identifier,
# options
:binary => false
)
item.page_items = items_with_tag(tag, items).sort { |x, y| x[:created_at] <=> y[:created_at] }
items << item
end
end
end
include Tagging