Knowledge Drop

Liquid syntax error: 'if' tag was never closed

  • 15 June 2021
  • 0 replies
  • 20 views

Last tested: Nov 30, 2020
 

Liquid tags can't have spaces between { and % or % and } .

For example, if we have:

{% if view_name.field_name._in_query %}

something to insert if true

{% else %}

something to insert if false

{ % endif % }

...we will see this error because the last line { % endif % } has these extra spaces. Removing any extra spaces (i.e., using {% endif %}) will resolve the error.

Other possible syntax issues (https://talk.jekyllrb.com/t/liquid-if-statement-error/2953):

  • We're missing a % somewhere.
  • We're missing a closing statement in our conditional logic.

 

This content is subject to limited support.                

 

 

 


0 replies

Be the first to reply!

Reply