Permalink
Browse files

Add pagination at 15 articles.

  • Loading branch information...
1 parent 3851e87 commit 485057c5129290db028581d7e19c73f365e7b4ea Jonathan Jackson committed Apr 24, 2012
Showing with 53 additions and 8 deletions.
  1. +2 −1 _config.yml
  2. +1 −6 _includes/_side-bar.html
  3. +50 −1 index.html
View
@@ -2,4 +2,5 @@ markdown: redcarpet
redcarpet:
extensions: [fenced_code, gh_blockcode, no_intraemphasis]
comments: true
-baseurl: /
+baseurl: /
+paginate: 15
@@ -1,27 +1,22 @@
<div><a href="http://feeds.feedburner.com/jonathan-jackson/WZqA" title="Subscribe to my feed" rel="alternate" type="application/rss+xml"><img src="/images/feeds.png" alt="" style="border:0;width:100px;height:100px;"/></a></div>
-<hr/>
<div><img src="/images/gravatar.png" width="167px;" height="167px;"/></div>
<div><a href="https://twitter.com/rondale_sc" class="twitter-follow-button" alt="follow me on twitter" data-width="150px" data-show-count="false">Follow @rondale_sc</a></div>
-<hr/>
-<div>
+<div style="margin-top:5px;">
<h3>Hi, I'm Jon.</h3>
<p>I love learning new things. Here is where I'll share what I learn. Typically code, sometimes my experience, sometimes just a neat trick.</p>
</div>
-<hr/>
<div>
<h3>Subscribe via Email</h3>
<!-- Begin MailChimp Signup Form -->
<link href="http://cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">
<div id="mc_embed_signup">
<form action="http://jonathan-jackson.us5.list-manage.com/subscribe/post?u=266baf97eddd87cfd15f1d015&amp;id=1ffe6549dc" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
-
<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</form>
</div>
<!--End mc_embed_signup-->
</div>
-<hr/>
<div>
<h3>Projects</h3>
<ul>
View
@@ -5,10 +5,59 @@
<div class="span9" id="articles">
<h1>Articles</h1>
<ul>
- {% for post in site.posts %}
+ {% for post in paginator.posts %}
<li><a href="{{ post.url | remove_extension }}">{{ post.title }}</a> (<span>{{ post.date | date_to_string }}</span>)<br/>
<p>{{ post.description }}</p>
</li>
{% endfor %}
</ul>
+
+<div class="pagination">
+ <ul>
+ {% if paginator.previous_page %}
+ {% if paginator.previous_page == 1 %}
+ <li>
+ <a href="/">&larr;</a>
+ </li>
+ {% else %}
+ <li>
+ <a href="/page{{paginator.previous_page}}">&larr;</a>
+ </li>
+ {% endif %}
+ {% else %}
+ <li class="disabled">
+ <a href="#">&larr;</a>
+ </li>
+ {% endif %}
+ {% if paginator.page == 1 %}
+ <li class="active">
+ <a href="#">1</a>
+ </li>
+ {% else %}
+ <li>
+ <a href="/">1</a>
+ </li>
+ {% endif %}
+ {% for count in (2..paginator.total_pages) %}
+ {% if count == paginator.page %}
+ <li class="active">
+ <a href="#">{{count}}</a>
+ </li>
+ {% else %}
+ <li>
+ <a href="/page{{count}}">{{count}}</a>
+ </li>
+ {% endif %}
+ {% endfor %}
+ {% if paginator.next_page %}
+ <li>
+ <a href="/page{{paginator.next_page}}">&rarr;</a>
+ </li>
+ {% else %}
+ <li class="disabled">
+ <a href="#">&rarr;</a>
+ </li>
+ {% endif %}
+ </ul>
+</div>
</div>

0 comments on commit 485057c

Please sign in to comment.