Add Layout#relative_path so the layout can tell us what its path is for error messages
This commit is contained in:
parent
6aae64c985
commit
a1a4b3937a
|
@ -215,9 +215,9 @@ module Jekyll
|
|||
payload["layout"] = Utils.deep_merge_hashes(payload["layout"] || {}, layout.data)
|
||||
|
||||
self.output = render_liquid(layout.content,
|
||||
payload,
|
||||
info,
|
||||
File.join(site.config['layouts_dir'], layout.name))
|
||||
payload,
|
||||
info,
|
||||
layout.relative_path)
|
||||
|
||||
# Add layout to dependency tree
|
||||
site.regenerator.add_dependency(
|
||||
|
|
|
@ -45,5 +45,13 @@ module Jekyll
|
|||
def process(name)
|
||||
self.ext = File.extname(name)
|
||||
end
|
||||
|
||||
# The path to the layout, relative to the site source.
|
||||
#
|
||||
# Returns a String path which represents the relative path
|
||||
# from the site source to this layout
|
||||
def relative_path
|
||||
@relative_path ||= Pathname.new(path).relative_path_from(Pathname.new(site.source)).to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -146,7 +146,7 @@ module Jekyll
|
|||
layout.content,
|
||||
payload,
|
||||
info,
|
||||
File.join(site.config['layouts_dir'], layout.name)
|
||||
layout.relative_path
|
||||
)
|
||||
|
||||
# Add layout to dependency tree
|
||||
|
|
Loading…
Reference in New Issue