-
-
Save jasonrhodes/7226155 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) | |
filename = 'version.html' | |
File.open(File.join(site.config["destination"], filename), 'w') do |f| | |
f.write(generate_report(site)) | |
end | |
site.pages << Page.new(site, site.dest, '/', filename) | |
end | |
private | |
def generate_report(site) | |
"Site generated with Jekyll version: #{Jekyll::VERSION}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I forked and fixed the problem (wish I could submit a PR across gists) but the issue is that you have to add the page into Jekyll's site.pages array after you create the file.
https://gist.github.com/jasonrhodes/7226155