Post + Page: extract real path retrieval into separate method (@parkr)

This commit is contained in:
maul.esel 2013-07-24 16:30:24 +02:00
parent d815e2b2a2
commit 6c6dd173c7
2 changed files with 12 additions and 2 deletions

View File

@ -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.

View File

@ -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