Merge pull request #1481 from mojombo/pathawks-patch-1

Expose Jekyll version to templates: `jekyll.version`
This commit is contained in:
Matt Rogers 2013-09-05 13:24:37 -07:00
commit 3212aac4bc
2 changed files with 8 additions and 1 deletions

View File

@ -99,3 +99,9 @@ Feature: Site data
When I run jekyll When I run jekyll
Then the _site directory should exist Then the _site directory should exist
And I should see "http://mysite.com" in "_site/index.html" And I should see "http://mysite.com" in "_site/index.html"
Scenario: Access Jekyll version via jekyll.version
Given I have an "index.html" page that contains "{{ jekyll.version }}"
When I run jekyll
Then the _site directory should exist
And I should see "\d+\.\d+\.\d+" in "_site/index.html"

View File

@ -266,7 +266,8 @@ module Jekyll
# "tags" - The Hash of tag values and Posts. # "tags" - The Hash of tag values and Posts.
# See Site#post_attr_hash for type info. # See Site#post_attr_hash for type info.
def site_payload def site_payload
{"site" => self.config.merge({ {"jekyll" => { "version" => Jekyll::VERSION },
"site" => self.config.merge({
"time" => self.time, "time" => self.time,
"posts" => self.posts.sort { |a, b| b <=> a }, "posts" => self.posts.sort { |a, b| b <=> a },
"pages" => self.pages, "pages" => self.pages,