fix frontmatter defaults for custom paths

The Page#path or Post#path can be overriden by by a frontmatter
setting. This causes path-based frontmatter default detection to
fail. Add test to demonstrate this and fix it.
This commit is contained in:
maul.esel 2013-10-14 19:16:53 +02:00
parent 1c52657d7d
commit 699eeba9f0
2 changed files with 3 additions and 3 deletions

View File

@ -39,8 +39,8 @@ Feature: frontmatter defaults
| about | 2013-10-14 | info on {{page.name}} |
And I have a special/_posts directory
And I have the following post in "special":
| title | date | content |
| about | 2013-10-14 | info on {{page.name}} |
| title | date | path | content |
| about | 2013-10-14 | local | info on {{page.name}} |
And I have an "index.html" page with title "overview" that contains "Overview for {{page.name}}"
And I have an "special/index.html" page with title "section overview" that contains "Overview for {{page.name}}"

View File

@ -92,7 +92,7 @@ module Jekyll
further_data = Hash[(attrs || self.class::ATTRIBUTES_FOR_LIQUID).map { |attribute|
[attribute, send(attribute)]
}]
defaults = site.frontmatter_defaults.all(self.path, self.type)
defaults = site.frontmatter_defaults.all(self.relative_path, self.type)
defaults.merge(data).deep_merge(further_data)
end