slashful pagination patterns
authorM. Taylor Saotome-Westlake <ultimatelyuntruethought@gmail.com>
Tue, 3 Jan 2017 04:20:24 +0000 (20:20 -0800)
committerM. Taylor Saotome-Westlake <ultimatelyuntruethought@gmail.com>
Tue, 3 Jan 2017 04:20:45 +0000 (20:20 -0800)
Really, the theme itself should use PAGINATION_PATTERNS rather than
making me hack the template. (All in all, pelican-simplegrey does not
seem technically polished to me.) But we make do with the blog engine we
have, and take pride in it not being boring, mainstream WordPress.

pelicanconf.py
theme/templates/pagination.inc.html

index aa5e3f5..1667b97 100644 (file)
@@ -47,6 +47,11 @@ PAGE_SAVE_AS = '{slug}/index.html'
 AUTHOR_URL = 'author/{slug}/'
 AUTHOR_SAVE_AS = 'author/{slug}/index.html'
 
+PAGINATION_PATTERNS = (
+    (1, '{base_name}/', '{base_name}/index.html'),
+    (2, '{base_name}/page/{number}/', '{base_name}/page/{number}/index.html'),
+)
+
 THEME = 'theme'
 
 # Uncomment following line if you want document-relative URLs when developing
index 64a80b3..5784130 100644 (file)
@@ -2,14 +2,14 @@
 <div class="pagination">
     {% if articles_page.has_previous() %}
         {% if articles_page.previous_page_number() == 1 %}
-            <a href="{{ SITEURL }}/{{ page_name }}.html">&laquo;</a>
+            <a href="{{ SITEURL }}/{{ page_name }}">&laquo;</a>
         {% else %}
-            <a href="{{ SITEURL }}/{{ page_name }}{{ articles_page.previous_page_number() }}.html">&laquo;</a>
+            <a href="{{ SITEURL }}/{{ page_name }}page/{{ articles_page.previous_page_number() }}/">&laquo;</a>
         {% endif %}
     {% endif %}
     Page {{ articles_page.number }} / {{ articles_paginator.num_pages }}
     {% if articles_page.has_next() %}
-        <a href="{{ SITEURL }}/{{ page_name }}{{ articles_page.next_page_number() }}.html">&raquo;</a>
+        <a href="{{ SITEURL }}/{{ page_name }}page/{{ articles_page.next_page_number() }}/">&raquo;</a>
     {% endif %}
 </div>
 {% endif %}