where each page would contain, say 10 posts?
(This would be something smilar to Google search result web page, where each page would have a certain number of results - I can click through to “2”, “3”, “4”, and so on…)
The closest documentation I’m seeing is Pagination, but the instruction isn’t clear.
It seems I have to do a global count of all the posts, cache it in a global variable, and that use that to generate all the pages. Is this the way to do it? Is there an easier way? Any ready or sample code?
It’s easy to implement with the data found in the link you gave. number_pagers correspond to 10 in this case, you get the current page in current_index. The arrows are shown in the example in the page.
I guess we could add the numbers to the example on the docs site.
I can only seem to loop collections in tera. I was expecting to either loop an array of pagers or write a loop that incremented i up to number_pages and manipulate a string to form the links based on the index.
I’ve probably missed something obvious but any further advice would be appreciated.