I have posts with tags foo
and I want to exclude them from my first page.
I tried putting this code in the first page template:
<div class="posts">
{% for post in paginator.posts %}
{% unless post.tags and post.tags contains "foo" %}
{% endunless %}
{% endfor %}
</div>
However, this leads to incorrect page breaks.
Here are some sample messages:
+-------+--------+-----+
| Index | Post | Tag |
+-------+--------+-----+
| 1 | Red | foo |
| 2 | Blue | |
| 3 | White | |
| 4 | Pink | foo |
| 5 | Orange | |
| 6 | Yellow | foo |
| 7 | Beige | foo |
| 8 | Purple | |
| 9 | Black | foo |
+-------+--------+-----+
Actual conclusion:
What I would like:
As you can see, the column is currently split into 5 and then my code filters them - I would like to apply filtering before pagination is calculated.
source
share