Implement archive pages

This commit is contained in:
Wesley Moore 2010-01-30 17:09:05 +11:00
parent b9489b7f62
commit db6fe5638c
6 changed files with 26 additions and 6 deletions

3
Rules
View file

@ -15,12 +15,15 @@ compile '/personal/articles/json/' do
end
compile '/articles/' do
filter :erb
layout 'articles'
end
compile '/technical/articles/' do
filter :erb
layout 'articles'
end
compile '/personal/articles/' do
filter :erb
layout 'articles'
end

11
content/articles.html Normal file
View file

@ -0,0 +1,11 @@
<ul class="articles">
<% sorted_articles[0..9].each do |article| %>
<%= render 'article', :article => article %>
<% end %>
</ul>
<div class="pagination">
<a href="/articles/#page-0" class="older">&laquo; Older</a>
|
<a href="/articles/#page-2" class="newer">Newer &raquo;</a>
</div>

View file

@ -1,3 +1,2 @@
---
title: Articles
body_class: articles
title: All Articles

View file

@ -1,3 +1,3 @@
<% sorted_articles[0..9].each do |article| %>
<% personal_articles[0..9].each do |article| %>
<%= render 'article', :article => article %>
<% end %>

View file

@ -1,3 +1,3 @@
<% sorted_articles[0..9].each do |article| %>
<% technical_articles[0..9].each do |article| %>
<%= render 'article', :article => article %>
<% end %>

View file

@ -8,7 +8,14 @@
<body class="articles">
<%= render 'header' %>
<div id="content">
<h1><%= @item[:title] %></h1>
<h1>Archives</h1>
<ul class="inline">
<li><a href="/articles/">All</a> (<%= sorted_articles.size %>)</li>
<li><a href="/technical/articles/">Technical</a> (<%= technical_articles.size %>)</li>
<li><a href="/personal/articles/">Personal</a> (<%= personal_articles.size %>)</li>
</ul>
<ul class="articles">
<%= yield %>
</ul>