我在一个Jekyll项目中有一系列的文章,其中有些文章只有标题,而有些文章有标题和内容。我想针对每种情况对文章进行不同的处理。例如:
{% for post in site.categories.publications %}
{{ post.title }}
{% if post.content == "" or post.content == nil or post.content == blank %}
<p>Nothing here.</p>
{% else %}
{{ post.content }}
{% endif %}
{% endfor %}
但是 if
语句实际上并没有捕获空的文章。我根据 这个页面 设定了条件,但是这三种可能性都没有捕获空的文章。对于如何处理这些文章,有什么想法吗?
if post.content != nil
- Ken Stipek