mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-06 03:01:43 -04:00
Improved permalinks for pages and collections
This updates the default permalink style for pages and collections to match the site-wide 'permalink' setting. If the permalink setting contains a trailing slash, either explicitly or by being set to ':pretty', then pages and collections permalinks will contain trailing slashes by default as well. Similarly, if the permalink setting contains a trailing ':output_ext', so will pages and collections. If the permalink setting contains neither a trailing slash or extension, neither will pages or collections. This impacts only the default permalink structure for pages and collections. Permalinks set in the frontmatter of an individual page take precedence, as does the permalink setting for a specific collection. Fixes #2691
This commit is contained in:
@@ -219,7 +219,31 @@ class TestDocument < JekyllUnitTest
|
||||
assert_equal "/slides/test/example-slide-1", @document.url
|
||||
end
|
||||
|
||||
should "produce the right destination" do
|
||||
should "produce the right destination file" do
|
||||
assert_equal @dest_file, @document.destination(dest_dir)
|
||||
end
|
||||
end
|
||||
|
||||
context "a document in a collection with pretty permalink style" do
|
||||
setup do
|
||||
@site = fixture_site({
|
||||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true,
|
||||
}
|
||||
},
|
||||
})
|
||||
@site.permalink_style = :pretty
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs[0]
|
||||
@dest_file = dest_dir("slides/example-slide-1/index.html")
|
||||
end
|
||||
|
||||
should "produce the right URL" do
|
||||
assert_equal "/slides/example-slide-1/", @document.url
|
||||
end
|
||||
|
||||
should "produce the right destination file" do
|
||||
assert_equal @dest_file, @document.destination(dest_dir)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user