diff --git a/features/permalinks.feature b/features/permalinks.feature index 14e0d1e3..639b56a1 100644 --- a/features/permalinks.feature +++ b/features/permalinks.feature @@ -63,3 +63,23 @@ Feature: Fancy permalinks When I run jekyll Then the _site directory should exist And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html" + + Scenario: Use per-post permalink + Given I have a _posts directory + And I have the following post: + | title | date | permalink | content | + | Some post | 4/14/2013 | /custom/posts/1 | bla bla | + When I run jekyll + Then the _site directory should exist + And the _site/custom/posts/1 directory should exist + And I should see "bla bla" in "_site/custom/posts/1/index.html" + + Scenario: Use per-post ending in .html + Given I have a _posts directory + And I have the following post: + | title | date | permalink | content | + | Some post | 4/14/2013 | /custom/posts/some.html | bla bla | + When I run jekyll + Then the _site directory should exist + And the _site/custom/posts directory should exist + And I should see "bla bla" in "_site/custom/posts/some.html" diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 136f048d..a1a1b797 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -65,7 +65,7 @@ Given /^I have the following (draft|post)s?(?: (in|under) "([^"]+)")?:$/ do |sta path = File.join(before, folder_post, after, filename) matter_hash = {} - %w(title layout tag tags category categories published author path date).each do |key| + %w(title layout tag tags category categories published author path date permalink).each do |key| matter_hash[key] = post[key] if post[key] end matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 98ad1c65..bea50b29 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -270,7 +270,7 @@ module Jekyll def destination(dest) # The url needs to be unescaped in order to preserve the correct filename path = File.join(dest, CGI.unescape(self.url)) - path = File.join(path, "index.html") if template[/\.html$/].nil? + path = File.join(path, "index.html") if path[/\.html$/].nil? path end