From 6c0e791236d97830c6580fe93322e4f888567a6c Mon Sep 17 00:00:00 2001 From: Alfred Xing Date: Wed, 10 Sep 2014 21:04:40 -0700 Subject: [PATCH 1/2] Use relative path for `path` Liquid variable in Documents --- lib/jekyll/document.rb | 3 +-- test/test_document.rb | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index f4761ef8..f7eb9569 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -232,8 +232,7 @@ module Jekyll Utils.deep_merge_hashes data, { "output" => output, "content" => content, - "path" => path, - "relative_path" => relative_path, + "path" => relative_path, "url" => url, "collection" => collection.label } diff --git a/test/test_document.rb b/test/test_document.rb index 5e26173f..3e927acd 100644 --- a/test/test_document.rb +++ b/test/test_document.rb @@ -44,6 +44,10 @@ class TestDocument < Test::Unit::TestCase assert_equal @document.to_liquid['collection'], "methods" end + should "output its relative path as path in Liquid" do + assert_equal @document.to_liquid['path'], "_methods/configuration.md" + end + end context "a document as part of a collection with frontmatter defaults" do From c3ec158f2d162f893139445893ac6ef5099c53dc Mon Sep 17 00:00:00 2001 From: Alfred Xing Date: Thu, 11 Sep 2014 18:25:21 -0700 Subject: [PATCH 2/2] Keep backwards compatibility Re-add `relative_path` Liquid variable too keep compatibility --- lib/jekyll/document.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index f7eb9569..6fe63c34 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -232,6 +232,7 @@ module Jekyll Utils.deep_merge_hashes data, { "output" => output, "content" => content, + "relative_path" => relative_path, "path" => relative_path, "url" => url, "collection" => collection.label