Jekyll循环在第二次迭代中中断
我在两个产品中循环——在post视图页面上,我引入了第二个post(在本例中,是一个相关的配方),它在第一个产品页面上解析得很好——在第二个产品页面上,Jekyll循环在第二次迭代中中断,jekyll,liquid,Jekyll,Liquid,我在两个产品中循环——在post视图页面上,我引入了第二个post(在本例中,是一个相关的配方),它在第一个产品页面上解析得很好——在第二个产品页面上,{{post.content}不会解析。我可以用{{post.content | markdownify}}破解它,但我想知道它为什么会崩溃。以下是相关代码: {% for post in site.categories.recipe %} {% if post.products contains page.title and post.
{{post.content}
不会解析。我可以用{{post.content | markdownify}}
破解它,但我想知道它为什么会崩溃。以下是相关代码:
{% for post in site.categories.recipe %}
{% if post.products contains page.title and post.featured %}
<div class="row">
<div class="four columns">
<h4>{{ post.title }}</h4>
<ul>
<li>Serves {{ post.serves }}</li>
<li>Prep: {{ post.time }}</li>
<li><a href=" ">Share</a></li>
</ul>
{{ post.content }}
...
<!-- All tags are closed, the rest just isn't relevant -->
{% endif %}
{% endfor %}
<pre>
{% assign counter=0 %}
{% for post in site.posts%}
{% if post.category == 'blog' and counter < 2 %}
{% assign counter=counter | plus:1 %}
{{post.content}}
{% endif %}
{% endfor %}
</pre>
{%用于site.categories.recipe%}
{%如果post.products包含page.title和post.featured%}
{{post.title}}
- 发球{post.Serves}
- 准备:{post.time}
{{post.content}}
...
{%endif%}
{%endfor%}
markdownify过滤器可能正在发挥作用,因为您从中提取的内容中可能存在未编码的特殊字符。我总是忘记把我的&
变成&代码>
如果您使用的是默认的Markdown解释器Maruku,下面列出了可能给您带来问题的实体及其编码等价物。还有更多关于Maruku的信息 请使用计数器找到我的解决方案
{%assign counter=0%}
{%用于站点中的帖子。帖子%}
{%if post.category=='blog'和计数器<2%}
{%分配计数器=计数器|加:1%}
{{post.content}
{%endif%}
{%endfor%}