diff --git a/History.txt b/History.txt index b9ab515f..c8691f7a 100644 --- a/History.txt +++ b/History.txt @@ -3,6 +3,7 @@ * Inclusion/exclusion of future dated posts (#59) * Generation for a specific time (#59) * site.time allocated on render not per site_payload invocation (#59) + * pages now present in the site payload and can be used through the site.pages variable * Bug Fixes * Render highlighted code for non markdown/textile pages (#116) * Expand source to full path so includes work anywhere (#101) diff --git a/features/create_sites.feature b/features/create_sites.feature index 6ae7a08a..8517e28d 100644 --- a/features/create_sites.feature +++ b/features/create_sites.feature @@ -39,11 +39,11 @@ Feature: Create sites Scenario: Basic site with layouts, pages, posts and files Given I have a _layouts directory - And I have a page layout that contains "Page Layout: {{ site.posts.size }}" - And I have a post layout that contains "Post Layout: {{ content }}" - And I have an "index.html" page with layout "page" that contains "site index page" + And I have a page layout that contains "Page {{ page.title }}: {{ content }}" + And I have a post layout that contains "Post {{ page.title }}: {{ content }}" + And I have an "index.html" page with layout "page" that contains "Site contains {{ site.pages.size }} pages and {{ site.posts.size }} posts" And I have a blog directory - And I have a "blog/index.html" page with layout "page" that contains "category index page" + And I have a "blog/index.html" page with layout "page" that contains "blog category index page" And I have an "about.html" file that contains "No replacement {{ site.posts.size }}" And I have an "another_file" file that contains "" And I have a _posts directory @@ -58,14 +58,14 @@ Feature: Create sites | entry4 | 6/27/2009 | post | content for entry4. | When I run jekyll Then the _site directory should exist - And I should see "Page Layout: 4" in "_site/index.html" + And I should see "Page : Site contains 2 pages and 4 posts" in "_site/index.html" And I should see "No replacement \{\{ site.posts.size \}\}" in "_site/about.html" And I should see "" in "_site/another_file" - And I should see "Page Layout: 4" in "_site/blog/index.html" - And I should see "Post Layout:

content for entry1.

" in "_site/2009/03/27/entry1.html" - And I should see "Post Layout:

content for entry2.

" in "_site/2009/04/27/entry2.html" - And I should see "Post Layout:

content for entry3.

" in "_site/category/2009/05/27/entry3.html" - And I should see "Post Layout:

content for entry4.

" in "_site/category/2009/06/27/entry4.html" + And I should see "Page : blog category index page" in "_site/blog/index.html" + And I should see "Post entry1:

content for entry1.

" in "_site/2009/03/27/entry1.html" + And I should see "Post entry2:

content for entry2.

" in "_site/2009/04/27/entry2.html" + And I should see "Post entry3:

content for entry3.

" in "_site/category/2009/05/27/entry3.html" + And I should see "Post entry4:

content for entry4.

" in "_site/category/2009/06/27/entry4.html" Scenario: Basic site with include tag Given I have a _includes directory diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index 188288f7..c7101179 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -80,10 +80,19 @@ module Jekyll # # Returns nothing def render(layouts, site_payload) - payload = {"page" => self.data}.deep_merge(site_payload) + payload = { + "page" => self.to_liquid + }.deep_merge(site_payload) + do_layout(payload, layouts) end + def to_liquid + self.data.deep_merge({ + "url" => self.url, + "content" => self.content }) + end + # Write the generated page file to the destination directory. # +dest_prefix+ is the String path to the destination dir # +dest_suffix+ is a suffix path to the destination dir diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 5ba5f16c..cfec6c2e 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -167,12 +167,10 @@ module Jekyll # Returns nothing def render(layouts, site_payload) # construct payload - payload = - { + payload = { "site" => { "related_posts" => related_posts(site_payload["site"]["posts"]) }, "page" => self.to_liquid - } - payload = payload.deep_merge(site_payload) + }.deep_merge(site_payload) do_layout(payload, layouts) end diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 286d02dc..2e3d9c98 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -230,11 +230,13 @@ module Jekyll # # Returns {"site" => {"time" =>