Use improved Page#dir
This commit is contained in:
parent
b70ee10198
commit
9daebe8dd2
|
@ -9,6 +9,8 @@ module Jekyll
|
||||||
|
|
||||||
alias_method :extname, :ext
|
alias_method :extname, :ext
|
||||||
|
|
||||||
|
FORWARD_SLASH = '/'.freeze
|
||||||
|
|
||||||
# Attributes for Liquid templates
|
# Attributes for Liquid templates
|
||||||
ATTRIBUTES_FOR_LIQUID = %w(
|
ATTRIBUTES_FOR_LIQUID = %w(
|
||||||
content
|
content
|
||||||
|
@ -55,9 +57,12 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the String destination directory.
|
# Returns the String destination directory.
|
||||||
def dir
|
def dir
|
||||||
dest_dir = url[-1, 1] == '/' ? url : File.dirname(url)
|
if url.end_with?(FORWARD_SLASH)
|
||||||
dest_dir << '/' unless dest_dir.end_with?('/')
|
url
|
||||||
dest_dir
|
else
|
||||||
|
url_dir = File.dirname(url)
|
||||||
|
url_dir.end_with?(FORWARD_SLASH) ? url_dir : "#{url_dir}/"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# The full path and filename of the post. Defined in the YAML of the post
|
# The full path and filename of the post. Defined in the YAML of the post
|
||||||
|
|
Loading…
Reference in New Issue