class Jekyll::Endless::TagPageGenerator

TagPageGenerator is a subclass of Generator

Public Instance Methods

generate(site) click to toggle source

A Generator needs to implement the generate method

# File lib/jekyll-theme-endless/generate-tagpages.rb, line 35
def generate(site)
        # If a layout with the name `page-tag` exists
        if site.layouts.key? 'page-tag'
                # The directory in which the files are to be created is configured in `site.tag_dir`.
                # If not, the directory `tags/` is used.
                dir = site.config['tag_dir'] || 'tags'

                # For each tag in the tag-list:
                site.tags.each_key do |tag|
                        # Create a page-object using TagPage and add it to the `site.pages` array
                        site.pages << TagPage.new(site, site.source, File.join(dir, tag), tag)
                end

        end
end