Sha256: b45028adb1e17363d20d56fadf40954dfa4cff3f5c4905c4e352899fbdd5c94f

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 Bytes

Contents

# frozen_string_literal: true

# Testing...
module CategoryCombiner
  # For each catagory, makes a combined page from the collection pages, saves into _site/combined/#{collection.label}.html.
  def combine
    proc do |site, _payload|
      site.collections.each do |_name, collection|
        collection_page = Jekyll::PageWithoutAFile.new(site, site.source, "combined", "#{collection.label}.html")
        collection_page.output = collection.docs.map(&:content).join("\f")
        site.pages << collection_page
      end
    end
  end

  module_function :combine

  Jekyll::Hooks.register(:site, :post_render, &combine)

  PluginMetaLogger.instance.logger.info { "Loaded CategoryCombiner v#{JekyllPluginTemplateVersion::VERSION} plugin." }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll_plugin_template-0.1.3 lib/category_combiner.rb