Permalink
Browse files

added pagination

  • Loading branch information...
1 parent a6818d1 commit ec1a15e350b15f70760714b89f59385ab3d1a419 @zackham zackham committed Jan 9, 2013
Showing with 57 additions and 3 deletions.
  1. +44 −3 index.html
  2. +13 −0 stylesheets/main.css
View
47 index.html
@@ -5,9 +5,50 @@
{% for post in paginator.posts %}
{% include postbody.html %}
{% endfor %}
-<p class="page_links">
- <a href="/page{{ paginator.next_page }}">Next page</a>
-</p>
+<!-- Pagination links -->
+<div id="post-pagination" class="pagination">
+
+ {% if paginator.previous_page %}
+ <p class="previous">
+ {% if paginator.previous_page == 1 %}
+ <a href="/">Previous</a>
+ {% else %}
+ <a href="/page{{paginator.previous_page}}">Previous</a>
+ {% endif %}
+ </p>
+ {% endif %}
+
+ <ul class="pages">
+ <li class="page">
+ {% if paginator.page == 1 %}
+ <span class="current-page">1</span>
+ {% else %}
+ <a href="/">1</a>
+ {% endif %}
+ </li>
+
+ {% for count in (2..paginator.total_pages) %}
+ <li class="page">
+ {% if count == paginator.page %}
+ <span class="current-page">{{count}}</span>
+ {% else %}
+ <a href="/page{{count}}">{{count}}</a>
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ul>
+
+ {% if paginator.next_page %}
+ <p class="next">
+ <a href="/page{{paginator.next_page}}">Next</a>
+ </p>
+ {% else %}
+ <p class="next disabled">
+ <span>Next</span>
+ </p>
+ {% endif %}
+
+</div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
View
13 stylesheets/main.css
@@ -73,3 +73,16 @@ p, ul {
img.postimage {
border:1px solid #000;
}
+
+#post-pagination {
+ margin-bottom: 12px;
+}
+#post-pagination .disabled {
+ color: #ccc;
+}
+#post-pagination p,ul,li {
+ display: inline;
+}
+#post-pagination .current-page {
+ color: #ccc;
+}

0 comments on commit ec1a15e

Please sign in to comment.