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 end
compile '/articles/' do compile '/articles/' do
filter :erb
layout 'articles' layout 'articles'
end end
compile '/technical/articles/' do compile '/technical/articles/' do
filter :erb
layout 'articles' layout 'articles'
end end
compile '/personal/articles/' do compile '/personal/articles/' do
filter :erb
layout 'articles' layout 'articles'
end 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 title: All Articles
body_class: 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 %> <%= render 'article', :article => article %>
<% end %> <% 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 %> <%= render 'article', :article => article %>
<% end %> <% end %>

View file

@ -8,11 +8,18 @@
<body class="articles"> <body class="articles">
<%= render 'header' %> <%= render 'header' %>
<div id="content"> <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"> <ul class="articles">
<%= yield %> <%= yield %>
</ul> </ul>
<div class="pagination"> <div class="pagination">
<a href="#page-0" class="older">&laquo; Older</a> <a href="#page-0" class="older">&laquo; Older</a>
| |