feat: v2.21.0 paging for homepage, likes and admin dashboard

The homepage showed only the 20 newest notes and /likes the 50 newest,
with no way back. The admin dashboard paged list_notes()'s default 50
newest, so it always said 'Page 1 of 2'. All three now count with
count_notes() and fetch one page with limit/offset. Public pages get
'<- Newer / Page N of M / Older ->' with rel=prev/next (h-feed paging),
?page=1 redirects to the bare URL, bad pages 404; the dashboard falls
back to the nearest valid page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-27 20:51:30 -07:00
1 parent 9074c9a08c
commit 615354d17e
11 files changed
+373 -60

No files matched your search

+4 -1
View File
@@ -1,7 +1,8 @@
{% extends "base.html" %}
{% from "partials/note_preview.html" import note_preview %}
{% from "partials/pager.html" import pager %}
{% block title %}{{ config.SITE_NAME }}{% endblock %}
{% block title %}{% if page and page > 1 %}Page {{ page }} · {% endif %}{{ config.SITE_NAME }}{% endblock %}
{% block content %}
<div class="h-feed">
@@ -39,5 +40,7 @@
{% else %}
<p class="empty-state">No notes published yet. Check back soon!</p>
{% endif %}
{{ pager('public.index', page, total_pages) }}
</div>
{% endblock %}
+4 -1
View File
@@ -1,7 +1,8 @@
{% extends "base.html" %}
{% from "partials/note_preview.html" import note_preview %}
{% from "partials/pager.html" import pager %}
{% block title %}Likes · {{ config.SITE_NAME }}{% endblock %}
{% block title %}Likes · {% if page and page > 1 %}Page {{ page }} · {% endif %}{{ config.SITE_NAME }}{% endblock %}
{% block content %}
<div class="h-feed">
@@ -21,6 +22,8 @@
<p class="empty-state">Nothing liked yet.</p>
{% endif %}
{{ pager('public.likes', page, total_pages) }}
<nav class="note-nav">
<a href="/">← All notes</a>
</nav>
+15
View File
@@ -0,0 +1,15 @@
{# Newer/older links for paged public lists (v2.21.0). Page 1 is the bare
URL. rel=prev/next let IndieWeb readers page through the h-feed. #}
{% macro pager(endpoint, page, total_pages) %}
{% if total_pages > 1 %}
<nav class="pager" aria-label="More notes">
{% if page > 1 %}
<a rel="prev" href="{{ url_for(endpoint, page=page - 1) if page > 2 else url_for(endpoint) }}">← Newer</a>
{% endif %}
<span class="pager-position">Page {{ page }} of {{ total_pages }}</span>
{% if page < total_pages %}
<a rel="next" href="{{ url_for(endpoint, page=page + 1) }}">Older →</a>
{% endif %}
</nav>
{% endif %}
{% endmacro %}