From 3a96d01e4a96cc0409c8001e8e92dfc2518c2b8c Mon Sep 17 00:00:00 2001 From: Alfred Xing Date: Sat, 13 Sep 2014 17:23:40 -0700 Subject: [PATCH] Make permalink parsing consistent with pages Require permalink to end in a slash to write an index file. Addresses #2920. --- lib/jekyll/post.rb | 2 +- test/test_post.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 293e2c5d..d1cfb008 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -269,7 +269,7 @@ module Jekyll def destination(dest) # The url needs to be unescaped in order to preserve the correct filename path = Jekyll.sanitized_path(dest, URL.unescape_path(url)) - path = File.join(path, "index.html") if path[/\.html?$/].nil? + path = File.join(path, "index.html") if self.url =~ /\/$/ path end diff --git a/test/test_post.rb b/test/test_post.rb index 48e2eb03..783b5c0c 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -589,7 +589,7 @@ class TestPost < Test::Unit::TestCase should "write properly without html extension" do post = setup_post("2008-10-18-foo-bar.textile") - post.site.permalink_style = ":title" + post.site.permalink_style = ":title/" do_render(post) post.write(dest_dir)