forked from github/pelican
feat: better navigation
This commit is contained in:
parent
755cabe0bb
commit
df34aec7f2
2 changed files with 73 additions and 30 deletions
|
|
@ -1,8 +1,9 @@
|
|||
{% if DEFAULT_PAGINATION %} {% set first_page = articles_paginator.page(1) %} {%
|
||||
set last_page = articles_paginator.page(articles_paginator.num_pages) %}
|
||||
{% if DEFAULT_PAGINATION %}
|
||||
{% set first_page = articles_paginator.page(1) %}
|
||||
{% set last_page = articles_paginator.page(articles_paginator.num_pages) %}
|
||||
<nav class="flex justify-center items-center">
|
||||
{% if articles_page.has_previous() %}
|
||||
<ul class="list-none inline-grid grid-cols-[max-content_max-content_max-content_max-content_max-content] border-t-2 border-rp-dawn-overlay dark:border-rp-moon-overlay m-4 p-4">
|
||||
{% if articles_page.has_previous() %}
|
||||
<ul class="list-none inline-grid grid-cols-[max-content_max-content_max-content_max-content_max-content_max-content] border-t-2 border-rp-dawn-overlay dark:border-rp-moon-overlay m-4 p-4">
|
||||
<span class="p-1">
|
||||
<li class="text-center bg-rp-dawn-overlay dark:bg-rp-moon-overlay w-12">
|
||||
<a
|
||||
|
|
@ -12,34 +13,47 @@ set last_page = articles_paginator.page(articles_paginator.num_pages) %}
|
|||
><tt>«</tt></a>
|
||||
</li>
|
||||
</span>
|
||||
{% else %}
|
||||
<!--If we are on the first page, there's no previous links, so reduce grid sizing-->
|
||||
<ul class="list-none inline-grid grid-cols-[max-content_max-content_max-content] border-t-2 border-rp-dawn-overlay dark:border-rp-moon-overlay m-4 p-4">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<!--If we are on the first page, there's no previous links, so reduce grid sizing-->
|
||||
<ul class="list-none inline-grid grid-cols-[max-content_max-content_max-content_max-content_max-content] border-t-2 border-rp-dawn-overlay dark:border-rp-moon-overlay m-4 p-4">
|
||||
{% endif %}
|
||||
<!-- Current page -->
|
||||
<span class="p-1">
|
||||
<li class="text-center">
|
||||
Page {{ articles_page.number }} of {{ articles_paginator.num_pages }}
|
||||
<li class="text-center bg-rp-dawn-gold dark:bg-rp-moon-pine dark:text-rp-moon-surface w-8 font-bold">
|
||||
{{ articles_page.number }}
|
||||
</li>
|
||||
</span>
|
||||
{% if articles_page.has_next() %}
|
||||
<span class="p-1">
|
||||
<li class="text-center bg-rp-dawn-overlay dark:bg-rp-moon-overlay w-8">
|
||||
<a
|
||||
class="block no-underline hover:no-underline"
|
||||
href="{{ SITEURL }}/{{ articles_next_page.url }}"
|
||||
title="Go to page {{ articles_page.next_page_number() }}"
|
||||
>{{ articles_page.next_page_number() }}</a>
|
||||
</li>
|
||||
</span>
|
||||
<span class="p-1">
|
||||
<li class="text-center bg-rp-dawn-overlay dark:bg-rp-moon-overlay w-12">
|
||||
<a
|
||||
class="block no-underline hover:no-underline align-top"
|
||||
href="{{ SITEURL }}/{{ articles_next_page.url }}"
|
||||
title="Go to the next page"
|
||||
><tt>»</tt></a>
|
||||
</li>
|
||||
</span>
|
||||
<span class="p-1">
|
||||
<li class="text-center bg-rp-dawn-overlay dark:bg-rp-moon-overlay w-8">
|
||||
<a
|
||||
class="block no-underline hover:no-underline"
|
||||
href="{{ SITEURL }}/{{ articles_next_page.url }}"
|
||||
title="Go to page {{ articles_page.next_page_number() }}"
|
||||
>{{ articles_page.next_page_number() }}</a>
|
||||
</li>
|
||||
</span>
|
||||
<span class="p-1">
|
||||
…
|
||||
</span>
|
||||
<span class="p-1">
|
||||
<li class="text-center bg-rp-dawn-overlay dark:bg-rp-moon-overlay w-8">
|
||||
<a
|
||||
class="block no-underline hover:no-underline"
|
||||
href="{{ SITEURL }}/{{ last_page.url }}"
|
||||
title="Go to last page"
|
||||
>{{ articles_paginator.num_pages }}</a>
|
||||
</li>
|
||||
</span>
|
||||
<span class="p-1">
|
||||
<li class="text-center bg-rp-dawn-overlay dark:bg-rp-moon-overlay w-12">
|
||||
<a
|
||||
class="block no-underline hover:no-underline align-top"
|
||||
href="{{ SITEURL }}/{{ articles_next_page.url }}"
|
||||
title="Go to the next page"
|
||||
><tt>»</tt></a>
|
||||
</li>
|
||||
</span>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue