Skip to content

Instantly share code, notes, and snippets.

@blakesmith
Created June 23, 2010 04:19
Show Gist options
  • Save blakesmith/449491 to your computer and use it in GitHub Desktop.
Save blakesmith/449491 to your computer and use it in GitHub Desktop.
# An example Jekyll generator. Utilizes the new plugin system.
#
# 1. Make a _plugins directory in your jekyll site, and put this class in a file there.
# 2. Upon site generation, version.html will be created in your root destination with
# # the version of Jekyll that generated it
module Jekyll
class VersionReporter < Generator
safe true
def generate(site)
File.open(File.join(site.config["destination"], 'version.html'), 'w') do |f|
f.write(generate_report(site))
end
end
private
def generate_report(site)
"Site generated with Jekyll version: #{Jekyll::VERSION}"
end
end
end
@pauldancepowerorg
Copy link

Changing the site.config["destination"] to site.source fixed this for me.

@neikvon
Copy link

neikvon commented Dec 30, 2014

create version.html in your root develop folder , fixed.
Jekyll version: 2.5.3

@mertcangokgoz
Copy link

this plugin does not run for me

jekyll 3.1.6 | Error:  No such file or directory @ rb_sysopen _site/version.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment