From 3a96d01e4a96cc0409c8001e8e92dfc2518c2b8c Mon Sep 17 00:00:00 2001 From: Alfred Xing Date: Sat, 13 Sep 2014 17:23:40 -0700 Subject: [PATCH 1/2] 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) From ccef84a8033f5d4b2a9ad4ef7b85d17a831d4c11 Mon Sep 17 00:00:00 2001 From: Alfred Xing Date: Sun, 14 Sep 2014 12:53:05 -0700 Subject: [PATCH 2/2] Update Cucumber tests to match new permalink parsing --- features/permalinks.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/permalinks.feature b/features/permalinks.feature index 67dfbb47..c4494b4e 100644 --- a/features/permalinks.feature +++ b/features/permalinks.feature @@ -39,7 +39,7 @@ Feature: Fancy permalinks And I have the following post: | title | category | date | content | | Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. | - And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title" + And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title/" When I run jekyll build Then the _site directory should exist And I should see "Totally custom." in "_site/blog/2009/03/27/custom-permalink-schema/index.html" @@ -68,7 +68,7 @@ Feature: Fancy permalinks Given I have a _posts directory And I have the following post: | title | date | permalink | content | - | Some post | 2013-04-14 | /custom/posts/1 | bla bla | + | Some post | 2013-04-14 | /custom/posts/1/ | bla bla | When I run jekyll build Then the _site directory should exist And the _site/custom/posts/1 directory should exist