Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress blank line in Jekyll?

Tags:

I use GitHub Pages for my blog, and am running into a problem with Jekyll. My post.html has a block like this:

{%    for testpost in site.posts   %} {%           four                  %} {%          lines of               %} {%         processing              %} {%         goes here               %} {%    endfor                       %} 

The part in the middle doesn't matter. The important part is the end of the line which is outside of the {% %} markup, and is therefore rendered into the html. Since this is in a loop, it's putting about 1000 blank lines into the middle of by HTML page. It doesn't affect the display, but it make a View/Source troublesome.

Any ideas on how to avoid those extra blank lines?

like image 543
James Curran Avatar asked Jul 19 '13 19:07

James Curran


1 Answers

Since Liquid v4 (included in Jekyll from v3.5) there is a Whitespace control, which finally resolved case with blank line, white space, etc.

Link to documentation: https://shopify.github.io/liquid/basics/whitespace/

like image 83
r4fx Avatar answered Sep 18 '22 09:09

r4fx