Class: JekyllThemeGuidesMbland::GeneratedPages

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-theme-guides-mbland/generated_pages.rb

Constant Summary collapse

DEFAULT_LAYOUT =
'jekyll_theme_guides_mbland_generated_home_redirect'.freeze

Class Method Summary collapse

Class Method Details

.generate_pages_from_generated_nodes(site, layout, nav_data, parent_url) ⇒ Object


13
14
15
16
17
18
19
20
21
# File 'lib/jekyll-theme-guides-mbland/generated_pages.rb', line 13

def self.generate_pages_from_generated_nodes(site, layout, nav_data,
  parent_url)
  (nav_data || []).select { |nav| nav['generated'] }.each do |nav|
    site.pages << GeneratedPage.new(site, layout, nav, parent_url)
    children = nav['children']
    next_url = parent_url + nav['url']
    generate_pages_from_generated_nodes(site, layout, children, next_url)
  end
end

.generate_pages_from_navigation_data(site) ⇒ Object


5
6
7
8
9
10
11
# File 'lib/jekyll-theme-guides-mbland/generated_pages.rb', line 5

def self.generate_pages_from_navigation_data(site)
  layout = site.config['generate_nodes']
  return if layout.nil? || layout == false
  layout = DEFAULT_LAYOUT if layout == true
  nav_data = site.config['navigation']
  generate_pages_from_generated_nodes(site, layout, nav_data, '/')
end