Use relative path for `path` Liquid variable in Documents

This commit is contained in:
Alfred Xing 2014-09-10 21:04:40 -07:00
parent 671b435b3b
commit 6c0e791236
2 changed files with 5 additions and 2 deletions

View File

@ -232,8 +232,7 @@ module Jekyll
Utils.deep_merge_hashes data, { Utils.deep_merge_hashes data, {
"output" => output, "output" => output,
"content" => content, "content" => content,
"path" => path, "path" => relative_path,
"relative_path" => relative_path,
"url" => url, "url" => url,
"collection" => collection.label "collection" => collection.label
} }

View File

@ -44,6 +44,10 @@ class TestDocument < Test::Unit::TestCase
assert_equal @document.to_liquid['collection'], "methods" assert_equal @document.to_liquid['collection'], "methods"
end end
should "output its relative path as path in Liquid" do
assert_equal @document.to_liquid['path'], "_methods/configuration.md"
end
end end
context "a document as part of a collection with frontmatter defaults" do context "a document as part of a collection with frontmatter defaults" do