Pagination on `tagged/tag` pages

shanedaugherty
New Member
1 0 0

Is it possible to use pagination on the `tagged/tag/${tag}` routes?

The code snippet below results in some empty pages due to the filtering happening after the pagination. 

Is there another object I should be accessing instead of `blogs.blog.articles` that has the filtering already applied? 

{% paginate blogs.blog.articles by 15 %}
{% assign count = 0 %}

{% for article in blogs.blog.articles %}
{% if article.tags contains 'keto' %}

{% include 'blog-post' %}

{% endif %}
{% endfor %}


<div class="pagination">
<a
{% if paginate.next.is_link %}
href="{{ paginate.previous.url }}"
{% endif %}
>
Previous
</a>

<a
{% if paginate.next.is_link %}
href="{{ paginate.next.url }}"
{% endif %}
>
Next
</a>
</div>

{% endpaginate %}

 

0 Likes