Skip to content

Instantly share code, notes, and snippets.

@gfscott
Last active August 29, 2025 00:09
Show Gist options
  • Select an option

  • Save gfscott/bfb78f68e794df5040683a29e748d299 to your computer and use it in GitHub Desktop.

Select an option

Save gfscott/bfb78f68e794df5040683a29e748d299 to your computer and use it in GitHub Desktop.
11ty pagination with Vento
{{ 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