Last active
August 29, 2025 00:09
-
-
Save gfscott/bfb78f68e794df5040683a29e748d299 to your computer and use it in GitHub Desktop.
11ty pagination with Vento
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {{ if (pagination.pages.length > 1) }} | |
| <nav class="pagination"> | |
| <span>Page: </span> | |
| {{# `pagination.pages` is an array of arrays, so `index` here acts as a counter #}} | |
| {{ for index, _content of pagination.pages }} | |
| {{if pagination.hrefs[index] == page.url}} | |
| <span class="pg" aria-current="page">{{index + 1}}</span> | |
| {{else}} | |
| <a href="{{pagination.hrefs[index]}}">{{index + 1}}</a> | |
| {{/if}} | |
| {{/for}} | |
| </nav> | |
| {{ /if }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment