Class: JekyllMeta::Generator

Inherits:
Jekyll::Generator
  • Object
show all
Defined in:
lib/jekyll_meta/generator.rb

Overview

A Jekyll plugin that injects build metadata into the site configuration.

This generator runs with the highest priority and safely adds useful environment details—such as Jekyll version, Ruby version, and build environment—into ‘site.config` for later use in templates or plugins.

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/jekyll_meta/generator.rb', line 13

def generate(site)
  site.config['meta'] ||= {}
  site.config['meta'].merge!(
    'jekyll_version' => Jekyll::VERSION,
    'jekyll_major_version' => Jekyll::VERSION.split('.').first.to_i,
    'environment' => Jekyll.env,
    'ruby_version' => RUBY_VERSION
  )
end