mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-06 03:01:43 -04:00
Add the 'title' variable to collection permalinks
This commit is contained in:
@@ -128,7 +128,8 @@ module Jekyll
|
||||
{
|
||||
collection: collection.label,
|
||||
path: cleaned_relative_path,
|
||||
output_ext: Jekyll::Renderer.new(site, self).output_ext
|
||||
output_ext: Jekyll::Renderer.new(site, self).output_ext,
|
||||
title: basename(".*")
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -186,6 +186,26 @@ class TestDocument < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "a document in a collection with custom permalinks" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true,
|
||||
"permalink" => "/slides/test/:title"
|
||||
}
|
||||
},
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir
|
||||
}))
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs[0]
|
||||
end
|
||||
|
||||
should "produce the right URL" do
|
||||
assert_equal "/slides/test/example-slide-1", @document.url
|
||||
end
|
||||
end
|
||||
|
||||
context "a static file in a collection" do
|
||||
setup do
|
||||
|
||||
Reference in New Issue
Block a user