I am fairly new to Timber and I am trying to get the pagination for a single post item working. Since there are a lot of topics around the pagination for archives, I want to underline that this is about a single post pagination, that handles a multi-page single post created with <!--nextpage--> tags. In basic WordPress/PHP usage it is handled with wp_link_pages() inside the loop.
As far as I understood, by searching SO and other websites, the magic should happen by just using the post.pagination array. But it's empty inside my twig file (and according to the Timber documentation does not exist at all inside the Timber\Post object).
My singular.php header looks like this:
$context = Timber::get_context();
$post_object = new Timber\Post();
And here is my twig file:
{% if post.pagination %}
<nav>Pages:
{% for page in post.pagination.pages %}
{% if page.current %}
<span class="current">{{ page.title }}</span>{{ loop.last ? '' : ', ' }}
{% else %}
<a href="{{ page.link }}">{{ page.title }}</a>{{ loop.last ? '' : ', ' }}
{% endif %}
{% endfor %}
</nav>
{% endif %}
What am I doing wrong, what am I missing, how can I get the single post pagination to work with Timber?