我正在遍历两个产品 - 在帖 subview 页面上,我拉入了一个辅助帖子(在示例中,一个相关的配方),它在第一个产品页面上解析得很好 - 在第二个产品页面上只是 {{ 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 %}
最佳答案
markdownify 过滤器可能使它起作用,因为可能存在未在您提取的内容中编码的特殊字符。我总是忘记把我的 &
变成 &
。
如果您使用的是默认的 Markdown 解释器 Maruku,这里列出了可能会给您带来问题的实体及其编码等价物。 http://maruku.rubyforge.org/entity_test.html 和更多关于 Maruku 的信息。 http://maruku.rubyforge.org/maruku.html
关于Jekyll 循环在第二次迭代时中断,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12911425/