commit 97b5864e2dc36e120af39e1b38bca3c3b4dca05c
parent 44d21d1de5808ada3c62dcc4ef03bc52b2a30f37
Author: Natalie Pendragon <natpen@natpen.net>
Date: Sun, 12 Jul 2020 09:27:35 -0400
[serve] Improve pager linking back to previous page
Specifically, if we're linking back to page #1, remove the page number
component of the URL path. This way, if you page forward and back,
then reload, you'll be prompted to enter a query. This improves the
user experience slightly in Elpher.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/serve/templates/fragments/pager.gmi b/serve/templates/fragments/pager.gmi
@@ -3,8 +3,10 @@ Page {{current_page}} of {{num_pages}} ({{num_results}} results)
{% if current_page > 2 %}
=> {{ search_path }}?{{ quoted_query }} First Page
{% endif %}
-{% if current_page > 1 %}
+{% if current_page > 2 %}
=> {{ search_path }}/{{ current_page - 1 }}?{{ quoted_query }} Previous Page
+{% elif current_page == 2 %}
+=> {{ search_path }}?{{ quoted_query }} Previous Page
{% endif %}
{% if current_page < num_pages %}
=> {{ search_path }}/{{ current_page + 1}}?{{ quoted_query }} Next Page