diff --git a/History.markdown b/History.markdown index 344a57fa..aef437dc 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) @@ -33,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 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/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. diff --git a/test/test_site.rb b/test/test_site.rb index ccd021a0..aa22e8a6 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -154,6 +154,13 @@ 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 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) + 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