Memoize destination of pages, documents and staticfiles (#8458)
Merge pull request 8458
This commit is contained in:
parent
56d59a1782
commit
920c6f4ddc
|
|
@ -257,13 +257,16 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the full path to the output file of this document.
|
# Returns the full path to the output file of this document.
|
||||||
def destination(base_directory)
|
def destination(base_directory)
|
||||||
path = site.in_dest_dir(base_directory, URL.unescape_path(url))
|
@destination ||= {}
|
||||||
if url.end_with? "/"
|
@destination[base_directory] ||= begin
|
||||||
path = File.join(path, "index.html")
|
path = site.in_dest_dir(base_directory, URL.unescape_path(url))
|
||||||
else
|
if url.end_with? "/"
|
||||||
path << output_ext unless path.end_with? output_ext
|
path = File.join(path, "index.html")
|
||||||
|
else
|
||||||
|
path << output_ext unless path.end_with? output_ext
|
||||||
|
end
|
||||||
|
path
|
||||||
end
|
end
|
||||||
path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Write the generated Document file to the destination directory.
|
# Write the generated Document file to the destination directory.
|
||||||
|
|
|
||||||
|
|
@ -158,10 +158,13 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the destination file path String.
|
# Returns the destination file path String.
|
||||||
def destination(dest)
|
def destination(dest)
|
||||||
path = site.in_dest_dir(dest, URL.unescape_path(url))
|
@destination ||= {}
|
||||||
path = File.join(path, "index") if url.end_with?("/")
|
@destination[dest] ||= begin
|
||||||
path << output_ext unless path.end_with? output_ext
|
path = site.in_dest_dir(dest, URL.unescape_path(url))
|
||||||
path
|
path = File.join(path, "index") if url.end_with?("/")
|
||||||
|
path << output_ext unless path.end_with? output_ext
|
||||||
|
path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the object as a debug String.
|
# Returns the object as a debug String.
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,8 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns destination file path.
|
# Returns destination file path.
|
||||||
def destination(dest)
|
def destination(dest)
|
||||||
@site.in_dest_dir(dest, Jekyll::URL.unescape_path(url))
|
@destination ||= {}
|
||||||
|
@destination[dest] ||= @site.in_dest_dir(dest, Jekyll::URL.unescape_path(url))
|
||||||
end
|
end
|
||||||
|
|
||||||
def destination_rel_dir
|
def destination_rel_dir
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue