class Zine::Tag
Posts' tags
Public Class Methods
new(tags_by_post, tag_templates, tag_index_templates, options)
click to toggle source
# File lib/zine/tag.rb, line 6 def initialize(tags_by_post, tag_templates, tag_index_templates, options) @options = options @posts_by_tag = sort_tags tags_by_post @templates = { tag: tag_templates, tag_index: tag_index_templates } @tag_dir = File.join @options['directories']['build'], 'tags' FileUtils.remove_dir @tag_dir, force: true FileUtils.mkdir_p @tag_dir end
Public Instance Methods
Private Instance Methods
write_tag_index()
click to toggle source
# File lib/zine/tag.rb, line 51 def write_tag_index tag_index_data = { build_dir: @tag_dir, name: 'index', title: 'All tags', post_array: @posts_by_tag.sort_by { |key, _v| key } } tag_index = DataPage.new(tag_index_data, @templates[:tag_index], @options) tag_index.write end