Liquid’s capture always returns a string!

This is a draft post. Find out more about what that means. Get in touch if this post could use an improvement.

This keeps tripping me up!

I use liquid templates a lot. In a capture block, the result of any operation will always be a string.

If you call a custom shortcode written in JavaScript that returns a boolean, the capture block would convert that to "true" or "false".

Then, if you check for truthy-ness of the captured variable down the line, you’ve got to compare it with a specific string: capturedVariable == "true"