Post + Page: extract real path retrieval into separate method (@parkr)
This commit is contained in:
parent
d815e2b2a2
commit
6c6dd173c7
|
|
@ -122,7 +122,12 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the path to the source file
|
# Returns the path to the source file
|
||||||
def path
|
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
|
end
|
||||||
|
|
||||||
# Obtain destination path.
|
# Obtain destination path.
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,12 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the path to the file relative to the site source
|
# Returns the path to the file relative to the site source
|
||||||
def path
|
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
|
end
|
||||||
|
|
||||||
# Compares Post objects. First compares the Post date. If the dates are
|
# Compares Post objects. First compares the Post date. If the dates are
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue