Module: JekyllThemeGuidesMbland

Defined in:
lib/jekyll-theme-guides-mbland/tags.rb,
lib/jekyll-theme-guides-mbland/version.rb,
lib/jekyll-theme-guides-mbland/generator.rb,
lib/jekyll-theme-guides-mbland/navigation.rb,
lib/jekyll-theme-guides-mbland/breadcrumbs.rb,
lib/jekyll-theme-guides-mbland/generated_nodes.rb,
lib/jekyll-theme-guides-mbland/generated_pages.rb,
lib/jekyll-theme-guides-mbland/namespace_flattener.rb

Defined Under Namespace

Modules: FrontMatter, NavigationMenu Classes: Breadcrumbs, GeneratedNodes, GeneratedPage, GeneratedPages, Generator, NamespaceFlattener, NavigationMenuWriter, PopLastUrlComponent, ShouldExpandNavTag

Constant Summary collapse

VERSION =
'1.0.5'.freeze

Class Method Summary collapse

Class Method Details

.update_navigation_configuration(basedir) ⇒ Object

Automatically updates the `navigation:` field in _config.yml.

Does this by parsing the front matter from files in `pages/`. Preserves the existing order of items in `navigation:`, but new items may need to be reordered manually.


127
128
129
130
131
132
133
134
135
136
# File 'lib/jekyll-theme-guides-mbland/navigation.rb', line 127

def self.update_navigation_configuration(basedir)
  config_path = File.join basedir, '_config.yml'
  config_data = SafeYAML.load_file config_path, safe: true
  return unless config_data
  nav_data = config_data['navigation'] || []
  NavigationMenu.validate_existing_data(nav_data)
  NavigationMenu.update_navigation_data(nav_data, basedir, config_data)
  NavigationMenuWriter.write_navigation_data_to_config_file(config_path,
    nav_data)
end