Firstly, thanks for this great static site generator!
I’m creating a small blog with it. I’m almost finished, but I noticed a small issue with the paginator. The link to [url]/page/1
redirects to [url]
and, because of that, it causes the whole page to flicker (especially noticeable with a dark theme).
Not a big deal, but I was wondering if I did something wrong and if this could be avoided.
I’m using something basic to navigate through pages of posts, like this:
{% if paginator %}
Pages:
{% if paginator.previous or paginator.next %}
<a class="page-prev" href='{{ paginator.previous }}' {% if not paginator.previous %}disabled{% endif %}><</a>
{% for pager in range(start=1, end=paginator.number_pagers+1) %}
<a class="page-nbr" href='{{ paginator.base_url }}{{pager}}' {% if paginator.current_index==pager %}disabled{% endif %}>
{{pager}}
</a>
{% endfor %}
<a class="page-next" href='{{ paginator.next }}' {% if not paginator.next %}disabled{% endif %}>></a>
{% else %}
<a class="page-nbr" href='{{ current_url }}' disabled>1</a>
{% endif %}
{% endif %}
Curiously, the paginator.previous
on page 2 is smart enough to yield [url]
instead of [url]/page/1
, so no flicker with this one. But if I use the default link to page 1, I get the redirect.
Why is there a redirect in the first place?
I started working on a work-around to avoid using [url]/page/1
but it’s tricky, I’m using this in a macro and I would have to pass the [url]
as extra parameter because it’s not possible to recover it (or maybe by string manipulation, by removing the /page/1
, if that’s possible at all in the limited macro language).