forked from nyancrimew/maia.crimew.gay
improve posts pagination
This commit is contained in:
parent
515c07f931
commit
ba0f9e5f33
3 changed files with 21 additions and 8 deletions
|
@ -1,10 +1,4 @@
|
||||||
<nav>
|
<nav class="pagination">
|
||||||
{% if pagination.nextPageLink -%}
|
|
||||||
{% set nextPageNumber = pagination.pageNumber + 1 %}
|
|
||||||
{% set nextPageLink = 'page/' ~ nextPageNumber %}
|
|
||||||
<a href="/{{ page.fileSlug }}/{{ nextPageLink }}" rel="prev">Older</a>
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{% if pagination.previousPageLink -%}
|
{% if pagination.previousPageLink -%}
|
||||||
{% set previousPageNumber = pagination.pageNumber - 1 %}
|
{% set previousPageNumber = pagination.pageNumber - 1 %}
|
||||||
{%- if pagination.pageNumber == 1 -%}
|
{%- if pagination.pageNumber == 1 -%}
|
||||||
|
@ -12,6 +6,14 @@
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{% set previousPageLink = 'page/' ~ previousPageNumber %}
|
{% set previousPageLink = 'page/' ~ previousPageNumber %}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<a href="/{{ page.fileSlug }}/{{ previousPageLink }}" rel="next">Newer</a>
|
<a class="next" href="/{{ page.fileSlug }}/{{ previousPageLink }}" rel="next">newer posts</a>
|
||||||
|
{% else %}
|
||||||
|
<div class="next"></div>
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{% if pagination.nextPageLink -%}
|
||||||
|
{% set nextPageNumber = pagination.pageNumber + 1 %}
|
||||||
|
{% set nextPageLink = 'page/' ~ nextPageNumber %}
|
||||||
|
<a class="prev" href="/{{ page.fileSlug }}/{{ nextPageLink }}" rel="prev">older posts</a>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</nav>
|
</nav>
|
|
@ -36,6 +36,15 @@ footer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
a {
|
||||||
|
font-weight: bolder;
|
||||||
|
font-size: large;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
footer,
|
footer,
|
||||||
#site_header,
|
#site_header,
|
||||||
.lavender-webring-container {
|
.lavender-webring-container {
|
||||||
|
|
|
@ -9,6 +9,8 @@ permalink: /posts/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumbe
|
||||||
---
|
---
|
||||||
{% extends 'layouts/default.njk' %}
|
{% extends 'layouts/default.njk' %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
|
{% include "components/pagination.njk" %}
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
{% for entry in pagination.items %}
|
{% for entry in pagination.items %}
|
||||||
<li class="list-entry">
|
<li class="list-entry">
|
||||||
|
|
Loading…
Reference in a new issue