diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index faf340b85..b20bee22a 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -45,8 +45,14 @@ module Jekyll # # Returns the template String. def template - if self.site.permalink_style == :pretty && !index? && html? - "/:path/:basename/" + if self.site.permalink_style == :pretty + if index? && html? + "/:path/" + elsif html? + "/:path/:basename/" + else + "/:path/:basename:output_ext" + end else "/:path/:basename:output_ext" end diff --git a/test/test_page.rb b/test/test_page.rb index 6d4bef2a2..8d13cda79 100644 --- a/test/test_page.rb +++ b/test/test_page.rb @@ -64,8 +64,13 @@ class TestPage < Test::Unit::TestCase context "in a directory hierarchy" do should "create url based on filename" do + @page = setup_page('/contacts', 'bar.html') + assert_equal "/contacts/bar/", @page.url + end + + should "create index url based on filename" do @page = setup_page('/contacts', 'index.html') - assert_equal "/contacts/index.html", @page.url + assert_equal "/contacts/", @page.url end should "return dir correctly" do @@ -75,7 +80,7 @@ class TestPage < Test::Unit::TestCase should "return dir correctly for index page" do @page = setup_page('/contacts', 'index.html') - assert_equal '/contacts', @page.dir + assert_equal '/contacts/', @page.dir end end end