Skip to content


Better reporting of Liquid errors #624

merged 1 commit into from

4 participants


The current issue is if you have a malformed Liquid call, Jekyll builds the site just fine but includes the Liquid exception as text on your page. You would have to stumble upon a page with an error on it to realize your code is wrong. If Liquid parsing/rendering fails, Jekyll should fail building as well (and alert you to what happened).

The solution is to call .render! rather than simply .render on Liquid templates. I do that here in the do_layout method of Convertible. I also add a stack trace dump and abort building Jekyll.


Please merge this in. I am using Jekyll for a project now and I want to have a pre-receive hook on my deploy git remote that runs jekyll and aborts the receive if there are any errors. Having raw liquid spewing out into the pages when it's entirely preventable is definitely not desirable.


I also support this. Rendering errors should not be hidden from developers. This is especially important when custom tags are used.

@mojombo mojombo merged commit 336ea66 into jekyll:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 14, 2012
  1. Better error reporting on Liquid exceptions

    Will Brady committed
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/jekyll/convertible.rb
12 lib/jekyll/convertible.rb
@@ -76,9 +76,13 @@ def do_layout(payload, layouts)
payload["pygments_suffix"] = converter.pygments_suffix
- self.content = Liquid::Template.parse(self.content).render(payload, info)
+ self.content = Liquid::Template.parse(self.content).render!(payload, info)
rescue => e
puts "Liquid Exception: #{e.message} in #{}"
+ e.backtrace.each do |backtrace|
+ puts backtrace
+ end
+ abort("Build Failed")
@@ -94,9 +98,13 @@ def do_layout(payload, layouts)
payload = payload.deep_merge({"content" => self.output, "page" =>})
- self.output = Liquid::Template.parse(layout.content).render(payload, info)
+ self.output = Liquid::Template.parse(layout.content).render!(payload, info)
rescue => e
puts "Liquid Exception: #{e.message} in #{["layout"]}"
+ e.backtrace.each do |backtrace|
+ puts backtrace
+ end
+ abort("Build Failed")
if layout = layouts[["layout"]]
Something went wrong with that request. Please try again.