From 699eeba9f02d0b59aced006be3979e15e4d9ac18 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Mon, 14 Oct 2013 19:16:53 +0200 Subject: [PATCH] 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. --- features/frontmatter_defaults.feature | 4 ++-- lib/jekyll/convertible.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/features/frontmatter_defaults.feature b/features/frontmatter_defaults.feature index 3b96dd07..ba00709c 100644 --- a/features/frontmatter_defaults.feature +++ b/features/frontmatter_defaults.feature @@ -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}}" diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 4e1cdf15..ecfa0f6a 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -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