Support pagination for the blog

master
southerntofu 3 years ago
parent 349d79627a
commit febdc49fbd
  1. 4
      config.toml
  2. 2
      content/blog/2020/new-homepage/index.fr.md
  3. 2
      content/blog/_index.fr.md
  4. 2
      content/blog/_index.md
  5. 11
      sass/style.scss
  6. 23
      templates/section.html

@ -27,6 +27,10 @@ name = "tildegit"
[translations.fr]
source = "Source de cette page"
readmore = "Lire la suite"
previousPage = "Page précédente"
nextPage = "Page suivante"
[translations.en]
source = "Source for this page"
readmore = "Read more"
previousPage = "Previous page"
nextPage = "Next page"

@ -1,7 +1,7 @@
+++
title = "Un nouveau site pour dnsmanager"
slug = "nouveau-site"
date = 2020-03-29
date = 2020-03-30
+++
Aujourd'hui, nous ouvrons un nouveau site web pour dnsmanager!

@ -1,3 +1,5 @@
+++
title = "Derniers articles"
paginate_by = 10
sort_by = "date"
+++

@ -1,3 +1,5 @@
+++
title = "Latest articles"
paginate_by = 10
sort_by = "date"
+++

@ -25,6 +25,17 @@ article > div:first-child {
font-weight: bold;
}
.pagination {
background-color: rgb(239, 239, 239);
margin-top: 1rem;
text-align: center;
> a {
font-weight: bolder;
font-variant: small-caps;
padding: 0 2rem;
}
}
main {
margin: 1rem 0;
}

@ -4,9 +4,10 @@
{% block main %}
<section class="h-feed">
<h1 class="p-name">{{ section.title }}</h1>
<h1><span class="p-name">{{ section.title }}</span>{% if paginator and paginator.number_pagers > 1 %} ({{ paginator.current_index }}/{{ paginator.number_pagers }}){% endif %}</h1>
<a class="u-url" hidden aria-hidden=true href="{{ section.permalink }}">Permalink</a>
{% for page in section.pages %}
{% set pages = paginator.pages| default(value=section.pages) %}
{% for page in pages %}
<article>
<div>
<a class="u-url" href="{{ page.permalink }}"><h2>{{ page.title }}</h2></a>
@ -24,5 +25,21 @@
{% endif %}
</article>
{% endfor %}
</article>
{% if paginator and paginator.number_pagers > 1 %}
<aside class="pagination">
{% if paginator.previous %}
<a href="{{ paginator.previous }}">
<--&nbsp;&nbsp;{% if lang %}{{ trans(key="previousPage", lang=lang) }}
{% else %}{{ trans(key="previousPage") }}{% endif %}
</a>
{% endif %}
{% if paginator.next %}
<a href="{{ paginator.next }}">
{% if lang %}{{ trans(key="nextPage", lang=lang) }}
{% else %}{{ trans(key="nextPage") }}{% endif %}&nbsp;&nbsp;-->
</a>
{% endif %}
</aside>
{% endif %}
</section>
{% endblock %}

Loading…
Cancel
Save