From cd946a587b2e595615606b7dd46fb6f10802e8e0 Mon Sep 17 00:00:00 2001 From: Kris Brown Date: Fri, 26 Feb 2010 22:07:26 +0000 Subject: [PATCH 1/2] removed tabs and made into a better example for sitemap times --- test/source/sitemap.xml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/source/sitemap.xml b/test/source/sitemap.xml index 96b38a14..8d9f0fcd 100644 --- a/test/source/sitemap.xml +++ b/test/source/sitemap.xml @@ -3,21 +3,21 @@ layout: nil --- - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> + - http://example.com - {{ site.time | date_to_xmlschema }} - daily - 1.0 - - - {% for post in site.posts %} - - http://example.com/{{ post.url }}/ - {{ site.time }} - monthly - 0.2 - - {% endfor %} - \ No newline at end of file + http://example.com + {{ site.time | date: "%Y-%m-%d" }} + daily + 1.0 + + + {% for post in site.posts %} + + http://example.com/{{ post.url }}/ + {{ post.date | date: "%Y-%m-%d" }} + monthly + 0.2 + + {% endfor %} + From 5a807aa12e52e9fd33a30c86e308dcf842b3ee4d Mon Sep 17 00:00:00 2001 From: Kris Brown Date: Fri, 26 Feb 2010 22:08:16 +0000 Subject: [PATCH 2/2] pages now present in the site payload and can be used through the site.pages variable --- History.txt | 1 + features/create_sites.feature | 20 ++++++++++---------- lib/jekyll/page.rb | 11 ++++++++++- lib/jekyll/post.rb | 6 ++---- lib/jekyll/site.rb | 2 ++ 5 files changed, 25 insertions(+), 15 deletions(-) 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 62a757dc..acb806f2 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -75,10 +75,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" =>