9
votes

I am new using Jekyll and Jekyll-Bootstrap.

I have found this for filtering by category:

<ul class="posts">
{% for post in site.posts %}
    {% if post.categories contains 'demography' %}
        <li><span>{{ post.date | date_to_string }}</span> &raquo; <a href="{{ BASE_PATH }}{{ post.url }}">{{ post.title }}</a></li>
    {% endif %}
{% endfor %}
</ul>

When I try to combine tags and categories it doesn't work:

<ul class="posts">
{% for post in site.posts %}
    {% if post.categories contains 'demography' and post.tags contains 'R' %} %}
        <li><span>{{ post.date | date_to_string }}</span> &raquo; <a href="{{ BASE_PATH }}{{ post.url }}">{{ post.title }}</a></li>
    {% endif %}
{% endfor %}
</ul>

Any idea?

Thanks in advance!

1
Simplistically, you could just use 2 if statements nested in each other.huon

1 Answers

4
votes

You have a %} too much in line #3.

Other than that, it should work fine.