Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/_includes/examples/pagination/nav/combined.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% raw %}
<nav aria-labelledby="my-pagination">
<h2 id="my-pagination">This is my Pagination</h2>
<ol>
<li>{% if page.url != pagination.href.first %}<a href="{{ pagination.href.first }}">First</a>{% else %}First{% endif %}</li>
<li>{% if pagination.href.previous %}<a href="{{ pagination.href.previous }}">Previous</a>{% else %}Previous{% endif %}</li>
{%- for pageEntry in pagination.pages %}
<li><a href="{{ pagination.hrefs[ forloop.index0 ] }}"{% if page.url == pagination.hrefs[ forloop.index0 ] %} aria-current="page"{% endif %}>Page {{ forloop.index }}</a></li>
{%- endfor %}
<li>{% if pagination.href.next %}<a href="{{ pagination.href.next }}">Next</a>{% else %}Next{% endif %}</li>
<li>{% if page.url != pagination.href.last %}<a href="{{ pagination.href.last }}">Last</a>{% else %}Last{% endif %}</li>
</ol>
</nav>
{% endraw %}
12 changes: 12 additions & 0 deletions src/_includes/examples/pagination/nav/firstlast.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% raw %}
<nav aria-labelledby="my-pagination">
<h2 id="my-pagination">This is my Pagination</h2>
<ol>
<li>{% if page.url != pagination.href.first %}<a href="{{ pagination.href.first }}">First</a>{% else %}First{% endif %}</li>
{%- for pageEntry in pagination.pages %}
<li><a href="{{ pagination.hrefs[ forloop.index0 ] }}"{% if page.url == pagination.hrefs[ forloop.index0 ] %} aria-current="page"{% endif %}>Page {{ forloop.index }}</a></li>
{%- endfor %}
<li>{% if page.url != pagination.href.last %}<a href="{{ pagination.href.last }}">Last</a>{% else %}Last{% endif %}</li>
</ol>
</nav>
{% endraw %}
13 changes: 13 additions & 0 deletions src/_includes/examples/pagination/nav/nextprev.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

{% raw %}
<nav aria-labelledby="my-pagination">
<h2 id="my-pagination">This is my Pagination</h2>
<ol>
<li>{% if page.url != pagination.href.first %}<a href="{{ pagination.href.first }}">First</a>{% else %}First{% endif %}</li>
{%- for pageEntry in pagination.pages %}
<li><a href="{{ pagination.hrefs[ forloop.index0 ] }}"{% if page.url == pagination.hrefs[ forloop.index0 ] %} aria-current="page"{% endif %}>Page {{ forloop.index }}</a></li>
{%- endfor %}
<li>{% if page.url != pagination.href.last %}<a href="{{ pagination.href.last }}">Last</a>{% else %}Last{% endif %}</li>
</ol>
</nav>
{% endraw %}
15 changes: 12 additions & 3 deletions src/docs/pagination/nav.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ Note that if the current page (`page.url`) is the first or last in the set, we w
<seven-minute-tabs persist sync>
{% renderFile "./src/_includes/syntax-chooser-tablist.11ty.js", {id: "paged-nav-nextprev", valid: "njk,js"} %}
<div id="paged-nav-nextprev-liquid" role="tabpanel">
<p><em>This example has not yet been added—you can swap to another template language above! Or maybe you want to contribute it? {% include "edit-on-github.njk" %}</em></p>
{%- codetitle "nextprev.liquid" %}
{%- highlight "liquid" %}
{%- include "examples/pagination/nav/nextprev.liquid" %}
{%- endhighlight %}
</div>
<div id="paged-nav-nextprev-njk" role="tabpanel">
{%- codetitle "nextprev.njk" %}
Expand All @@ -284,7 +287,10 @@ For clarity here, we’re omitting the previous and next links from the previous
<seven-minute-tabs persist sync>
{% renderFile "./src/_includes/syntax-chooser-tablist.11ty.js", {id: "paged-nav-firstlast", valid: "njk,js"} %}
<div id="paged-nav-firstlast-liquid" role="tabpanel">
<p><em>This example has not yet been added—you can swap to another template language above! Or maybe you want to contribute it? {% include "edit-on-github.njk" %}</em></p>
{%- codetitle "firstlast.liquid" %}
{%- highlight "liquid" %}
{%- include "examples/pagination/nav/firstlast.liquid" %}
{%- endhighlight %}
</div>
<div id="paged-nav-firstlast-njk" role="tabpanel">
{%- codetitle "firstlast.njk" %}
Expand All @@ -309,7 +315,10 @@ Here’s the final pagination navigation template code, pieced together:
<seven-minute-tabs persist sync>
{% renderFile "./src/_includes/syntax-chooser-tablist.11ty.js", {id: "paged-nav-combined", valid: "njk,js"} %}
<div id="paged-nav-combined-liquid" role="tabpanel">
<p><em>This example has not yet been added—you can swap to another template language above! Or maybe you want to contribute it? {% include "edit-on-github.njk" %}</em></p>
{%- codetitle "combined.liquid" %}
{%- highlight "liquid" %}
{%- include "examples/pagination/nav/combined.liquid" %}
{%- endhighlight %}
</div>
<div id="paged-nav-combined-njk" role="tabpanel">
{%- codetitle "combined.njk" %}
Expand Down