diff --git a/lib/jekyll/frontmatter_defaults.rb b/lib/jekyll/frontmatter_defaults.rb index 11eebf3f..160e6bec 100644 --- a/lib/jekyll/frontmatter_defaults.rb +++ b/lib/jekyll/frontmatter_defaults.rb @@ -173,7 +173,7 @@ module Jekyll if path.nil? || path.empty? "" else - path.gsub(/\A\//, '').gsub(/([^\/])\z/, '\1/') + path.gsub(/\A\//, '').gsub(/([^\/])\z/, '\1') end end end diff --git a/test/test_front_matter_defaults.rb b/test/test_front_matter_defaults.rb index 0c7f5bf4..27eb7d83 100644 --- a/test/test_front_matter_defaults.rb +++ b/test/test_front_matter_defaults.rb @@ -28,6 +28,32 @@ class TestFrontMatterDefaults < JekyllUnitTest end end + context "A site with fron matter type pages and an extension" do + setup do + @site = Site.new(Jekyll.configuration({ + "source" => source_dir, + "destination" => dest_dir, + "defaults" => [{ + "scope" => { + "path" => "index.html" + }, + "values" => { + "key" => "val" + } + }] + })) + + @site.process + @affected = @site.pages.find { |page| page.relative_path == "index.html" } + @not_affected = @site.pages.find { |page| page.relative_path == "about.html" } + end + + should "affect only the specified path" do + assert_equal @affected.data["key"], "val" + assert_equal @not_affected.data["key"], nil + end + end + context "A site with front matter defaults with no type" do setup do @site = Site.new(Jekyll.configuration({