I'm trying to use Timber's pagination features, but the links being rendered just send me to a 404 page. Here is how I'm getting the list of posts:
$posts = new Timber\PostQuery([
'post_type' => 'event',
'paged' => $paged,
'posts_per_page' => 6,
]);
$context['posts'] = $posts;
And how I'm rendering them:
{% if posts.pagination.pages is not empty %}
<nav class="navigation" role="navigation">
<ol class="pagination">
{% if posts.pagination.prev %}
{% include "wp/pagination/_pagination-link.twig" with {"class": posts.pagination.prev.class, "link": posts.pagination.prev.link, "title": "←"} %}
{% endif %}
{% for page in posts.pagination.pages %}
{% include "wp/pagination/_pagination-link.twig" with {"class": page.class, "link": page.link, "title": page.title} %}
{% endfor %}
{% if posts.pagination.next %}
{% include "wp/pagination/_pagination-link.twig" with {"class": posts.pagination.prev.class, "link": posts.pagination.next.link, "title": "→"} %}
{% endif %}
</ol><!-- /.pagination -->
</nav><!-- /.navigation -->
{% endif %}
When I visit the page, the URL path is /event/ and when I click the second/next page button, it links to /event/page/2/, but Wordpress doesn't run the same php file (archive-event.php).
How do I configure the pagination links? Can I switch them to put the page in the query like /event?page=2?