Sha256: 6f578d144ef87ca25c73fad59280eaf23d0c49b6450ea80d5fc02057c820ec90

Contents?: true

Size: 721 Bytes

Versions: 69

Compression:

Stored size: 721 Bytes

Contents

module Jekyll
  module OpenProjectHelpers

    #
    # Infers from available content whether the site is a hub
    # or individual project site, and adds site-wide config variable
    # accessible as {{ site.is_hub }} in Liquid.
    #
    class SiteTypeVariableGenerator < Generator
      def generate(site)
        site.config['is_hub'] = false

        # If there’re projects defined, we assume it is indeed
        # a Jekyll Open Project hub site.
        if site.collections.key? 'projects'
          if site.collections['projects'] != nil
            if site.collections['projects'].docs.length > 0
              site.config['is_hub'] = true
            end
          end
        end
      end
    end

  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
jekyll-theme-open-project-helpers-1.2 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.27 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.26 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.25 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.24 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.23 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.22 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.21 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.20 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.19 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.18 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.17 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.16 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.15 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.14 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.13 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.12 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.11 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.1.10 lib/jekyll-theme-open-project-helpers/site_type.rb
jekyll-theme-open-project-helpers-1.0.10 lib/jekyll-theme-open-project-helpers/site_type.rb