diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 42350643..50fd983c 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -146,6 +146,8 @@ module Jekyll "/:categories/:title.html" when :date "/:categories/:year/:month/:day/:title.html" + when :ordinal + "/:categories/:year/:y_day/:title.html" else self.site.permalink_style.to_s end @@ -170,6 +172,7 @@ module Jekyll "i_month" => date.strftime("%m").to_i.to_s, "categories" => categories.map { |c| URI.escape(c.to_s) }.join('/'), "short_month" => date.strftime("%b"), + "y_day" => date.strftime("%j"), "output_ext" => self.output_ext }.inject(template) { |result, token| result.gsub(/:#{Regexp.escape token.first}/, token.last) diff --git a/test/test_post.rb b/test/test_post.rb index 8a9721e4..b5b082a3 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -214,6 +214,18 @@ class TestPost < Test::Unit::TestCase end end + context "with ordinal style" do + setup do + @post.site.permalink_style = :ordinal + @post.process(@fake_file) + end + + should "process the url correctly" do + assert_equal "/:categories/:year/:y_day/:title.html", @post.template + assert_equal "/2008/253/foo-bar.html", @post.url + end + end + context "with custom date permalink" do setup do @post.site.permalink_style = '/:categories/:year/:i_month/:i_day/:title/'