diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index f1fcdf2a..85b22ba5 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -127,7 +127,7 @@ module Jekyll # # Returns the computed URL for the document. def url - @url ||= URL.new({ + @url = URL.new({ template: url_template, placeholders: url_placeholders, permalink: permalink diff --git a/test/source/_slides/example-slide-3.html b/test/source/_slides/example-slide-3.html new file mode 100644 index 00000000..ecdc79e0 --- /dev/null +++ b/test/source/_slides/example-slide-3.html @@ -0,0 +1,5 @@ +--- + title: Override permalink + layout: slide + permalink: /slide/3/ +--- diff --git a/test/test_document.rb b/test/test_document.rb index 98fde67e..330a1846 100644 --- a/test/test_document.rb +++ b/test/test_document.rb @@ -165,6 +165,28 @@ class TestDocument < Test::Unit::TestCase end end + context "a document in a collection with a custom permalink" do + setup do + @site = Site.new(Jekyll.configuration({ + "collections" => ["slides"], + "source" => source_dir, + "destination" => dest_dir + })) + @site.process + @document = @site.collections["slides"].docs[2] + @dest_file = dest_dir("slide/3/index.html") + end + + should "know its permalink" do + assert_equal "/slide/3/", @document.permalink + end + + should "produce the right URL" do + assert_equal "/slide/3/", @document.url + end + end + + context " a document part of a rendered collection" do end