ruby - Jekyll: check if post content empty -
i have series of posts in jekyll project of have title , have title , content. want different things post in each case. example:
{% 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 %}
but if
statement doesn't catch empty posts. based conditions on this page, none of 3 possibilities catch empty posts. ideas on how handle these posts?
make sure have nothing after front matter
--- --- no new line here !!
no space, no new line
sometimes text editor add newline @ end of file. can rid of :
{% assign content = post.content | strip_newlines %}
and test :
{% if content == "" %}
Comments
Post a Comment