diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index 3f984709..1542e986 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -135,12 +135,12 @@ module Jekyll # # Returns the path to the source file def path - data.fetch("path") { relative_path.sub(%r{!\A\/!}, "") } + data.fetch("path") { relative_path } end # The path to the page source file, relative to the site source def relative_path - File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)) + File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).sub(%r{\A\/}, "") end # Obtain destination path. diff --git a/test/test_front_matter_defaults.rb b/test/test_front_matter_defaults.rb index f1b55ac1..51308016 100644 --- a/test/test_front_matter_defaults.rb +++ b/test/test_front_matter_defaults.rb @@ -17,7 +17,7 @@ class TestFrontMatterDefaults < JekyllUnitTest }] })) @site.process - @affected = @site.pages.find { |page| page.relative_path == "/contacts/bar.html" } + @affected = @site.pages.find { |page| page.relative_path == "contacts/bar.html" } @not_affected = @site.pages.find { |page| page.relative_path == "about.html" } end