diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index fb4a8fb0a..9c728d56a 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -122,7 +122,12 @@ module Jekyll # # Returns the path to the source file def path - self.data.fetch('path', File.join(@dir, @name).sub(/\A\//, '')) + self.data.fetch('path', self.relative_path.sub(/\A\//, '')) + end + + # The path to the page source file, relative to the site source + def relative_path + File.join(@dir, @name) end # Obtain destination path. diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 7777ab576..415a3f66c 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -124,7 +124,12 @@ module Jekyll # # Returns the path to the file relative to the site source def path - self.data.fetch('path', File.join(@dir, '_posts', @name).sub(/\A\//, '')) + self.data.fetch('path', self.relative_path.sub(/\A\//, '')) + end + + # The path to the post source file, relative to the site source + def relative_path + File.join(@dir, '_posts', @name) end # Compares Post objects. First compares the Post date. If the dates are