Empty Liquid block not rendering


#1

I have a custom block plugin (Liquid::Block) that does not render if there is no content between the opening and closing tag. The template that is supposed to be rendered contains both HTML and a {{ content }} variable for the content, so it is not blank even if there is no content between the tags. If there is content, it renders absolutely normally.

I tried checking for empty content inside the plugin code and assigning some generic content to empty blocks so they would render, but it seems that blocks that have no content in the source .md file are simply ignored regardless of how you try to hack the block content in the plugin code.

Is this the expected Jekyll/Liquid behavior and is there a way to try and force rendering even if there is no content?


#2

Found a solution that seems to work, in case anyone else has the same issue:

http://www.rubydoc.info/gems/liquid/Liquid%2FBlock:blank%3F


#3

Thanks, I’m having the same issue, but what was your solution? (The link you gave is only to a query method.)

Ah, found it. Override the blank? method and return false!