如何在Jekyll中消除空白行? [英] How to suppress blank line in Jekyll?

查看:84
本文介绍了如何在Jekyll中消除空白行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将GitHub Pages用于我的博客,并且遇到了Jekyll问题.我的post.html中有一个这样的块:

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                       %}

中间的部分无关紧要.重要的部分是该行的结尾,该结尾在{% %}标记之外,因此呈现为html.由于这是一个循环,因此它将大约1000个空行放入HTML页面的中间.它不会影响显示,但会给视图/源"带来麻烦.

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?

推荐答案

由于Liquid v4(包括在v3.5Jekyll中),因此存在Whitespace control,该问题最终解决了空白行,空格,等

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

文档链接: https://shopify.github.io/liquid/basics/whitespace /

这篇关于如何在Jekyll中消除空白行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆