Created
August 28, 2025 00:14
-
-
Save gfscott/2d5ac3cb1c212d36627b19cc7803cd93 to your computer and use it in GitHub Desktop.
11ty pagination with Nunjucks
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> | |
| {% for pageEntry in pagination.pages %} | |
| {% if page.url == pagination.hrefs[ loop.index0 ] %} | |
| <span class="pg" aria-current="page">{{ loop.index }}</span> | |
| {% else %} | |
| <a href="{{ pagination.hrefs[ loop.index0 ] }}">{{ loop.index }}</a> | |
| {% endif %} | |
| {% endfor %} | |
| </nav> | |
| {% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment