Merge pull request #2620 from alfredxing/warn-on-layout-nonexistent
This commit is contained in:
commit
592afc270e
|
@ -153,6 +153,15 @@ module Jekyll
|
||||||
!asset_file?
|
!asset_file?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Checks if the layout specified in the document actually exists
|
||||||
|
#
|
||||||
|
# layout - the layout to check
|
||||||
|
#
|
||||||
|
# Returns true if the layout is invalid, false if otherwise
|
||||||
|
def invalid_layout?(layout)
|
||||||
|
!data["layout"].nil? && data["layout"] != "none" && layout.nil? && !(self.is_a? Jekyll::Excerpt)
|
||||||
|
end
|
||||||
|
|
||||||
# Recursively render layouts
|
# Recursively render layouts
|
||||||
#
|
#
|
||||||
# layouts - a list of the layouts
|
# layouts - a list of the layouts
|
||||||
|
@ -163,6 +172,9 @@ module Jekyll
|
||||||
def render_all_layouts(layouts, payload, info)
|
def render_all_layouts(layouts, payload, info)
|
||||||
# recursively render layouts
|
# recursively render layouts
|
||||||
layout = layouts[data["layout"]]
|
layout = layouts[data["layout"]]
|
||||||
|
|
||||||
|
Jekyll.logger.warn("Build Warning:", "Layout '#{data["layout"]}' requested in #{path} does not exist.") if invalid_layout? layout
|
||||||
|
|
||||||
used = Set.new([layout])
|
used = Set.new([layout])
|
||||||
|
|
||||||
while layout
|
while layout
|
||||||
|
|
|
@ -92,6 +92,15 @@ module Jekyll
|
||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Checks if the layout specified in the document actually exists
|
||||||
|
#
|
||||||
|
# layout - the layout to check
|
||||||
|
#
|
||||||
|
# Returns true if the layout is invalid, false if otherwise
|
||||||
|
def invalid_layout?(layout)
|
||||||
|
!document.data["layout"].nil? && layout.nil?
|
||||||
|
end
|
||||||
|
|
||||||
# Render layouts and place given content inside.
|
# Render layouts and place given content inside.
|
||||||
#
|
#
|
||||||
# content - the content to be placed in the layout
|
# content - the content to be placed in the layout
|
||||||
|
@ -101,6 +110,9 @@ module Jekyll
|
||||||
def place_in_layouts(content, payload, info)
|
def place_in_layouts(content, payload, info)
|
||||||
output = content.dup
|
output = content.dup
|
||||||
layout = site.layouts[document.data["layout"]]
|
layout = site.layouts[document.data["layout"]]
|
||||||
|
|
||||||
|
Jekyll.logger.warn("Build Warning:", "Layout '#{document.data["layout"]}' requested in #{document.relative_path} does not exist.") if invalid_layout? layout
|
||||||
|
|
||||||
used = Set.new([layout])
|
used = Set.new([layout])
|
||||||
|
|
||||||
while layout
|
while layout
|
||||||
|
|
Loading…
Reference in New Issue