From 3c1d45f45ff209d48b697caa390e1de33270d7a0 Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Thu, 19 Dec 2013 01:02:25 -0500 Subject: [PATCH 1/6] Sort pages by name by default The order that files are returned differs across operating systems, so ensure that they're being sorted after the fact. --- lib/jekyll/site.rb | 2 ++ test/test_site.rb | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index d7149d70..8fee59cf 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -175,6 +175,8 @@ module Jekyll static_files << StaticFile.new(self, self.source, dir, f) end end + + pages.sort_by!(&:name) end # Read all the files in //_posts and create a new Post diff --git a/test/test_site.rb b/test/test_site.rb index 35359a2a..09d4ecff 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -154,6 +154,14 @@ class TestSite < Test::Unit::TestCase assert_equal @site.generators.sort_by(&:class).map{|g|g.class.priority}, @site.generators.map{|g|g.class.priority} end + should "sort pages in a consistent way" do + # The order that files are returned differs across operating systems, so ensure that they're being sorted after the fact. + stub.proxy(Dir).entries { |entries| entries.reverse } + @site.process + sorted_pages = %w(.htaccess about.html bar.html contacts.html deal.with.dots.html foo.md index.html index.html sitemap.xml symlinked-file) + assert_equal sorted_pages, @site.pages.map(&:name) + end + should "read layouts" do @site.read_layouts assert_equal ["default", "simple", "post/simple"].sort, @site.layouts.keys.sort From a6e1c400511496b06a5d5f1565a89b240d33e137 Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Thu, 19 Dec 2013 01:05:00 -0500 Subject: [PATCH 2/6] link to Stack Overflow answer re: Dir sorting --- test/test_site.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_site.rb b/test/test_site.rb index 09d4ecff..bf517ba1 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -156,6 +156,7 @@ class TestSite < Test::Unit::TestCase should "sort pages in a consistent way" do # The order that files are returned differs across operating systems, so ensure that they're being sorted after the fact. + # http://stackoverflow.com/a/5529966/358804 stub.proxy(Dir).entries { |entries| entries.reverse } @site.process sorted_pages = %w(.htaccess about.html bar.html contacts.html deal.with.dots.html foo.md index.html index.html sitemap.xml symlinked-file) From 45ee9f814a7816cb3b9cdfeec367487f745aca38 Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Thu, 19 Dec 2013 13:46:43 -0500 Subject: [PATCH 3/6] clarify page sorting test --- test/test_site.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/test_site.rb b/test/test_site.rb index bf517ba1..a530f9d0 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -154,9 +154,7 @@ class TestSite < Test::Unit::TestCase assert_equal @site.generators.sort_by(&:class).map{|g|g.class.priority}, @site.generators.map{|g|g.class.priority} end - should "sort pages in a consistent way" do - # The order that files are returned differs across operating systems, so ensure that they're being sorted after the fact. - # http://stackoverflow.com/a/5529966/358804 + should "sort pages alphabetically" do stub.proxy(Dir).entries { |entries| entries.reverse } @site.process sorted_pages = %w(.htaccess about.html bar.html contacts.html deal.with.dots.html foo.md index.html index.html sitemap.xml symlinked-file) From 8cb1dc47d9abf08a0dec034e61b90810f582425a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 19 Dec 2013 15:20:51 -0500 Subject: [PATCH 4/6] Update history to reflect merge of #1848 --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index 344a57fa..f7df0ba4 100644 --- a/History.markdown +++ b/History.markdown @@ -14,6 +14,7 @@ property's value (#1788) * Add support for Maruku's `fenced_code_blocks` option (#1799) * Update Redcarpet dependency to ~> 3.0 (#1815) + * Automatically sort all pages by name (#1848) ### Bug Fixes * Don't allow nil entries when loading posts (#1796) From c79f170687767aafd7bcc2734685dc0a53564201 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Thu, 19 Dec 2013 14:39:23 -0700 Subject: [PATCH 5/6] Fix typo in docs. --- site/docs/datafiles.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/docs/datafiles.md b/site/docs/datafiles.md index 93b50aa3..b3421c38 100644 --- a/site/docs/datafiles.md +++ b/site/docs/datafiles.md @@ -13,7 +13,7 @@ templating system](http://wiki.github.com/shopify/liquid/liquid-for-designers). Jekyll supports loading data from [YAML](http://yaml.org/) files located in the `_data` directory. -This powerful features allows you to avoid repetition in your templates and to +This powerful feature allows you to avoid repetition in your templates and to set site specific options without changing `_config.yml`. Plugins/themes can also leverage Data Files to set configuration variables. From 354b4b9c545d05e52cb2180411ed0240b72a6832 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 19 Dec 2013 19:58:36 -0500 Subject: [PATCH 6/6] Update history to reflect merge of #1854 --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index f7df0ba4..aef437dc 100644 --- a/History.markdown +++ b/History.markdown @@ -34,6 +34,7 @@ * Fix issues with 1.4.1 release blog post (#1804) * Add note about deploying to OpenShift (#1812) * Collect all Windows-related docs onto one page (#1818) + * Fixed typo in datafiles doc page (#1854) ## 1.4.2 / 2013-12-16