Rendering Liquid and Handlebars Expressions in Jekyll Code Blocks

Written on March 16, 2016

Sharing blocks of code is something that I do regularly on my site as well as other sites that I blog on.

Liquid (templating library for Jekyll) and Handlebars expressions (templating library found in Ember applications) use the curly braces to render content. When placing them in code blocks in Jekyll, Jekyll will by default try to render them as expressions instead of just raw code.

To fix this issue and render the code block with with Liquid and Handlebars expressions as code and not for Jekyll to try to render as content, you can use the {% raw %} liquid expression.

Stay in touch

Thanks for reading this article. I'd love to stay in touch and share more tips on programming and side projects with you. Sign up and I'll send you my articles straight to your email, you'll also get a free copy of the light themed version of my Git cheat sheet.
Git cheat sheet preview image