Class: Jekyll::OpenProjectHelpers::SiteTypeVariableGenerator
- Inherits:
-
Generator
- Object
- Generator
- Jekyll::OpenProjectHelpers::SiteTypeVariableGenerator
- Defined in:
- lib/jekyll-theme-open-project-helpers/site_type.rb
Overview
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.
Instance Method Summary collapse
Instance Method Details
#generate(site) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jekyll-theme-open-project-helpers/site_type.rb', line 10 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 |