From ef2fabb189c63fa2cdca65e52c4664a43bc468f7 Mon Sep 17 00:00:00 2001 From: Kris Brown Date: Sat, 27 Feb 2010 14:09:07 +0000 Subject: [PATCH 1/2] also provide html_pages. this is better for sitemaps should you wish to auto-populate page entries --- lib/jekyll/page.rb | 14 ++++++-------- lib/jekyll/site.rb | 1 + 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index c7101179..12544e7d 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -119,15 +119,13 @@ module Jekyll "#" end - private + def html? + output_ext == '.html' + end - def html? - output_ext == '.html' - end - - def index? - basename == 'index' - end + def index? + basename == 'index' + end end diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 2e3d9c98..e43d0b89 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -237,6 +237,7 @@ module Jekyll "time" => self.time, "posts" => self.posts.sort { |a,b| b <=> a }, "pages" => self.pages, + "html_pages" => self.pages.reject { |page| !page.html? }, "categories" => post_attr_hash('categories'), "tags" => post_attr_hash('tags')})} end From 80b13a81fa865c87782a1c6c781a47a5ae288535 Mon Sep 17 00:00:00 2001 From: Kris Brown Date: Sat, 27 Feb 2010 14:11:06 +0000 Subject: [PATCH 2/2] added usage of site.html_pages to test source sitemap.xml --- test/source/sitemap.xml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/source/sitemap.xml b/test/source/sitemap.xml index 8d9f0fcd..e84d32fe 100644 --- a/test/source/sitemap.xml +++ b/test/source/sitemap.xml @@ -14,10 +14,19 @@ layout: nil {% for post in site.posts %} - http://example.com/{{ post.url }}/ + http://example.com{{ post.url }}/ {{ post.date | date: "%Y-%m-%d" }} monthly 0.2 {% endfor %} + + {% for page in site.html_pages %} + + http://example.com{{ page.url }} + {{ site.time | date: "%Y-%m-%d" }} + {% if page.changefreq %}{{ page.changefreq }}{% endif %} + {% if page.priority %}{{ page.priority }}{% endif %} + + {% endfor %}