Implemented archives. * Closes #12.
jump to
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: april-2006 +:title: "Archive: April 2006" +:filters_pre: +- erb +- redcloth +----- + +14 items were written in _April 2006_: + +<% articles_by_month.select{|i| i[0] == "April 2006"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: april-2008 +:title: "Archive: April 2008" +:filters_pre: +- erb +- redcloth +----- + +2 items were written in _April 2008_: + +<% articles_by_month.select{|i| i[0] == "April 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: april-2009 +:title: "Archive: April 2009" +:filters_pre: +- erb +- redcloth +----- + +3 items were written in _April 2009_: + +<% articles_by_month.select{|i| i[0] == "April 2009"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: august-2006 +:title: "Archive: August 2006" +:filters_pre: +- erb +- redcloth +----- + +3 items were written in _August 2006_: + +<% articles_by_month.select{|i| i[0] == "August 2006"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: august-2007 +:title: "Archive: August 2007" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _August 2007_: + +<% articles_by_month.select{|i| i[0] == "August 2007"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: august-2008 +:title: "Archive: August 2008" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _August 2008_: + +<% articles_by_month.select{|i| i[0] == "August 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: december-2005 +:title: "Archive: December 2005" +:filters_pre: +- erb +- redcloth +----- + +9 items were written in _December 2005_: + +<% articles_by_month.select{|i| i[0] == "December 2005"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: december-2007 +:title: "Archive: December 2007" +:filters_pre: +- erb +- redcloth +----- + +5 items were written in _December 2007_: + +<% articles_by_month.select{|i| i[0] == "December 2007"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: december-2008 +:title: "Archive: December 2008" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _December 2008_: + +<% articles_by_month.select{|i| i[0] == "December 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: february-2006 +:title: "Archive: February 2006" +:filters_pre: +- erb +- redcloth +----- + +2 items were written in _February 2006_: + +<% articles_by_month.select{|i| i[0] == "February 2006"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: february-2009 +:title: "Archive: February 2009" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _February 2009_: + +<% articles_by_month.select{|i| i[0] == "February 2009"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: january-2006 +:title: "Archive: January 2006" +:filters_pre: +- erb +- redcloth +----- + +2 items were written in _January 2006_: + +<% articles_by_month.select{|i| i[0] == "January 2006"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: january-2007 +:title: "Archive: January 2007" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _January 2007_: + +<% articles_by_month.select{|i| i[0] == "January 2007"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: january-2008 +:title: "Archive: January 2008" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _January 2008_: + +<% articles_by_month.select{|i| i[0] == "January 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: january-2009 +:title: "Archive: January 2009" +:filters_pre: +- erb +- redcloth +----- + +2 items were written in _January 2009_: + +<% articles_by_month.select{|i| i[0] == "January 2009"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: july-2006 +:title: "Archive: July 2006" +:filters_pre: +- erb +- redcloth +----- + +4 items were written in _July 2006_: + +<% articles_by_month.select{|i| i[0] == "July 2006"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: july-2007 +:title: "Archive: July 2007" +:filters_pre: +- erb +- redcloth +----- + +5 items were written in _July 2007_: + +<% articles_by_month.select{|i| i[0] == "July 2007"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: july-2008 +:title: "Archive: July 2008" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _July 2008_: + +<% articles_by_month.select{|i| i[0] == "July 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: july-2009 +:title: "Archive: July 2009" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _July 2009_: + +<% articles_by_month.select{|i| i[0] == "July 2009"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: june-2005 +:title: "Archive: June 2005" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _June 2005_: + +<% articles_by_month.select{|i| i[0] == "June 2005"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: june-2006 +:title: "Archive: June 2006" +:filters_pre: +- erb +- redcloth +----- + +2 items were written in _June 2006_: + +<% articles_by_month.select{|i| i[0] == "June 2006"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: june-2007 +:title: "Archive: June 2007" +:filters_pre: +- erb +- redcloth +----- + +3 items were written in _June 2007_: + +<% articles_by_month.select{|i| i[0] == "June 2007"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: june-2008 +:title: "Archive: June 2008" +:filters_pre: +- erb +- redcloth +----- + +4 items were written in _June 2008_: + +<% articles_by_month.select{|i| i[0] == "June 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: june-2009 +:title: "Archive: June 2009" +:filters_pre: +- erb +- redcloth +----- + +2 items were written in _June 2009_: + +<% articles_by_month.select{|i| i[0] == "June 2009"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: march-2006 +:title: "Archive: March 2006" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _March 2006_: + +<% articles_by_month.select{|i| i[0] == "March 2006"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: march-2007 +:title: "Archive: March 2007" +:filters_pre: +- erb +- redcloth +----- + +2 items were written in _March 2007_: + +<% articles_by_month.select{|i| i[0] == "March 2007"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: march-2008 +:title: "Archive: March 2008" +:filters_pre: +- erb +- redcloth +----- + +2 items were written in _March 2008_: + +<% articles_by_month.select{|i| i[0] == "March 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: march-2009 +:title: "Archive: March 2009" +:filters_pre: +- erb +- redcloth +----- + +4 items were written in _March 2009_: + +<% articles_by_month.select{|i| i[0] == "March 2009"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: may-2006 +:title: "Archive: May 2006" +:filters_pre: +- erb +- redcloth +----- + +12 items were written in _May 2006_: + +<% articles_by_month.select{|i| i[0] == "May 2006"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: may-2008 +:title: "Archive: May 2008" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _May 2008_: + +<% articles_by_month.select{|i| i[0] == "May 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: may-2009 +:title: "Archive: May 2009" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _May 2009_: + +<% articles_by_month.select{|i| i[0] == "May 2009"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: november-2005 +:title: "Archive: November 2005" +:filters_pre: +- erb +- redcloth +----- + +4 items were written in _November 2005_: + +<% articles_by_month.select{|i| i[0] == "November 2005"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: november-2006 +:title: "Archive: November 2006" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _November 2006_: + +<% articles_by_month.select{|i| i[0] == "November 2006"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: november-2007 +:title: "Archive: November 2007" +:filters_pre: +- erb +- redcloth +----- + +3 items were written in _November 2007_: + +<% articles_by_month.select{|i| i[0] == "November 2007"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: november-2008 +:title: "Archive: November 2008" +:filters_pre: +- erb +- redcloth +----- + +3 items were written in _November 2008_: + +<% articles_by_month.select{|i| i[0] == "November 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: october-2007 +:title: "Archive: October 2007" +:filters_pre: +- erb +- redcloth +----- + +3 items were written in _October 2007_: + +<% articles_by_month.select{|i| i[0] == "October 2007"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: october-2008 +:title: "Archive: October 2008" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _October 2008_: + +<% articles_by_month.select{|i| i[0] == "October 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: september-2006 +:title: "Archive: September 2006" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _September 2006_: + +<% articles_by_month.select{|i| i[0] == "September 2006"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: september-2007 +:title: "Archive: September 2007" +:filters_pre: +- erb +- redcloth +----- + +6 items were written in _September 2007_: + +<% articles_by_month.select{|i| i[0] == "September 2007"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -0,0 +1,15 @@
+----- +:type: page +:permalink: september-2008 +:title: "Archive: September 2008" +:filters_pre: +- erb +- redcloth +----- + +1 item was written in _September 2008_: + +<% articles_by_month.select{|i| i[0] == "September 2008"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
@@ -14,19 +14,16 @@ toc: true
----- <% max_items = 5 -get_max_articles = lambda do |sorted| - sorted[sorted.length-(max_items)..sorted.length-1].reverse -end -sorted_l = @site.pages.select{|p| p.attributes[:date] && p.attributes[:type] == 'article'}.sort{|a, b| a.attributes[:date] <=> b.attributes[:date]} -latest = get_max_articles.call sorted_l -sorted_p = @site.pages.select{|p| p.attributes[:date] && p.attributes[:type] == 'article' && p.attributes[:popular]}.sort{|a, b| a.attributes[:date] <=> b.attributes[:date]} -popular = get_max_articles.call sorted_p +all_articles = latest_articles +latest = latest_articles 5 +popular = popular_articles 5 +tags = sorted_site_tags %><div class="panel" id="home"> h2. Welcome -This is Fabio Cevasco's web site, featuring his "articles":/#archives and open source "projects":/#projects. Fabio is a full-time technical writer working in Genoa, Italy. In his free time, he enjoys writing (surprise, surprise), reading about technology and programming a little bit in Ruby and other languages. +This is Fabio Cevasco's web site, featuring <%= all_articles.length %> "articles":/#archives and <%= 5 %> open source "projects":/#projects. Fabio is a full-time technical writer working in Genoa, Italy. In his free time, he enjoys writing (surprise, surprise), reading about technology and programming a little bit in Ruby and other languages. You can contact him by writing an email to _h3rald [at] h3rald [dot] com_, or through:@@ -58,12 +55,36 @@ </div>
<div class="clearleft"></div> </div> <div class="panel" id="archives"> - h2. Archives +<notextile> <div id="search_form"></div> <div id="search_results"></div> + <h3>Articles by Topic</h3> + <table id="taglist"> + <% c = 0 + tags.each do |t| + c = c+1 %> + <%= "<tr>" if c%5 == 1 %> + <td><%= tag_link_with_count(t[0], t[1]) %></td> + <%= "</tr>" if c%5 == 0 %> + <% end %></tr> + </table> + <h3>Articles by Month</h3> + <table id="timeline"> + <% c = 0 + articles_by_month.each do |m| + c = c+1 %> + <%= "<tr>" if c%5 == 1 %> + <td><%= month_link_with_count(m[0], m[1].length) %></td> + <%= "</tr>" if c%5 == 0 %> + <% end %></tr> + </table> </div> +</notextile> + + + <div class="panel" id="projects"> h2. Projects
@@ -4,6 +4,6 @@ -----
<div class="article-item"> <h4><a href="/articles/<%= @article.attributes[:permalink]%>/"><%= @article.attributes[:title]%></a></h4><% unless (@article.attributes[:tags].empty?) then %><div class="article-tags"><%= "Tagged as: "+@article.attributes[:tags].map{ |t| %{<a href="/tags/#{t}" class="tag">#{t}</a>} }.join(", ") %> </div> - <% end %><% if (@article.attributes[:summary]) then %><div class="article-summary"><%= @article.attributes[:summary] %> + <% end %><% if (@article.attributes[:summary] && !@no_summary) then %><div class="article-summary"><%= @article.attributes[:summary] %> </div><% end %> </div>
@@ -5,7 +5,7 @@ <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> - <title>H3RALD</title> + <title><%= @page.title %> - H3RALD</title> <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.h3rald.com/rss" /> <link rel="alternate" type="application/atom+xml" title="ATOM" href="http://www.h3rald.com/atom" /> <meta name="author" content="Fabio Cevasco" />@@ -25,8 +25,6 @@ <link href="/css/layout.css" media="all" rel="stylesheet" type="text/css" />
<link href="/css/text.css" media="all" rel="stylesheet" type="text/css" /> <link href="/css/elements.css" media="all" rel="stylesheet" type="text/css" /> <link href="/css/code.css" media="all" rel="stylesheet" type="text/css" /> - <script src="http://www.google.com/jsapi?key=ABQIAAAA6h3j8Jri5D_da53UPbEbThRlq2n1sm52B5HDRR5tm6o8XM18FhTKn3v155RpPeD0kWnWG81QEhhifQ" type="text/javascript"></script> - <script src="/js/search.js" type="text/javascript"></script> <script src="/js/jquery-1.3.2.js" type="text/javascript"></script> <script src="/js/cufon-yui.js" type="text/javascript"></script> <script src="/js/Mutlu_400.font.js" type="text/javascript"></script>@@ -131,8 +129,10 @@ H3RALD Web Site v8.0.0 <em>"xStatic"</em> — © 2004-2009 <strong>Fabio Cevasco</strong> — <a class="link" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Some rights reserved</a> | <a href="http://validator.w3.org/check?uri=referer" class="link">XHTML 1.1</a> | <a href="http://jigsaw.w3.org/css-validator/" class="link">CSS 2.1</a>
</div> </div> <!-- END FOOTER CONTAINER--> </div> <!-- END FOOTER --> + <script src="http://www.google.com/jsapi?key=ABQIAAAA6h3j8Jri5D_da53UPbEbThRlq2n1sm52B5HDRR5tm6o8XM18FhTKn3v155RpPeD0kWnWG81QEhhifQ" type="text/javascript"></script> + <script src="/js/search.js" type="text/javascript"></script> <script type="text/javascript"> - Cufon.now(); + Cufon.now(); </script> </body> </html>
@@ -0,0 +1,71 @@
+module Nanoc::Helpers::Tagging + + def site_tags + ts = {} + @pages.each do |p| + next unless p.tags + p.tags.each do |t| + if ts[t] + ts[t] = ts[t]+1 + else + ts[t] = 1 + end + end + end + ts + end + + def tag_link_with_count(tag, count) + %{#{link_for_tag(tag, '/tags/')} (#{count})} + end + + def sorted_site_tags + site_tags.sort{|a, b| a[1] <=> b[1]}.reverse + end + +end + +module Nanoc::Helpers::Site + + def latest_articles(max=nil) + total = @site.pages.select{|p| p.attributes[:date] && p.attributes[:type] == 'article'}.sort{|a, b| a.attributes[:date] <=> b.attributes[:date]}.reverse + max ||= total.length + total[0..max-1] + end + + def popular_articles(max=nil) + total = @site.pages.select{|p| p.attributes[:date] && p.attributes[:type] == 'article' && p.attributes[:popular]}.sort{|a, b| a.attributes[:date] <=> b.attributes[:date]}.reverse + max ||= total.length + total[0..max-1] + end + + def articles_by_month + articles = latest_articles + m_articles = [] + index = -1 + current_month = "" + articles.each do |a| + next unless a.attributes[:date] + month = a.attributes[:date].strftime("%B %Y") + if current_month != month then + # new month + m_articles << [month, [a]] + index = index + 1 + current_month = month + else + # same month + m_articles[index][1] << a + end + end + m_articles + end + + def month_link_with_count(month, count) + permalink = month.downcase.gsub /\s/, '-' + %{<a href="/archives/#{permalink}/">#{month}</a> (#{count})} + end + +end + +include Nanoc::Helpers::Tagging +include Nanoc::Helpers::Site
@@ -110,7 +110,7 @@ {
margin-left: 0; } -.tag, .link, .cross-link +.tag, .link, .cross-link, #taglist a, #timeline a { color: #B80000; margin: 0 1px;@@ -119,7 +119,7 @@ font-style: italic;
border: none; } -.tag:hover, .link:hover, .cross-link:hover +.tag:hover, .link:hover, .cross-link:hover, #taglist a:hover { color: #FF0900; border: none;@@ -230,19 +230,20 @@ {
background-color: #C0C0C0; } -#taglist +#taglist, #timeline { width: 100%; border-bottom: none; + margin: 20px 0; } -#taglist tr +#taglist tr, #timeline tr { padding:2px; width: 100%; } -#taglist td +#taglist td, #timeline td { padding:2px; border-left: none;@@ -253,43 +254,49 @@ /**** FORMS ****/
input[type=submit] { - color: #ccc; - border: 1px solid #A4282D; - background: #333; + color: #333; + border: 2px solid #333; + background: #ccc; outline:none; + padding: 0.1em 0.3em; + vertical-align: middle; + } input[type=submit]:hover { - border: 1px solid #CF282D; - background: #ccc; - color: #333; + border: 2px solid #CF282D; + background: #eee; + color: #121212; } input[type=submit]:active { background: #aaa; + outline:none; } input[type=text] { - color: #ccc; - border: 1px solid #A4282D; - background: #333; + color: #333; + border: 2px solid #333; + background: #fff; outline:none; - height: 18px; + text-align: left; + height: 21px; + vertical-align: middle; } input[type=text]:hover { - border: 1px solid #CF282D; - background: #ccc; - color: #333; + border: 2px solid #CF282D; + background: #FFEA8D; } -input[type=text]:focus +input[type=text]:focus, input[type=text]:active { - background: #aaa; + border: 2px solid #CF282D; + background: #FFEA8D; } /* Google Search */@@ -297,7 +304,6 @@
#search_form { clear:both; - margin-left: 10px; } .gsc-resultsHeader, .gs-visibleUrl, .gsc-trailing-more-results, .gs-watermark@@ -305,19 +311,22 @@ {
display:none; } +.gsc-result +{ + padding: 0.5em 0; +} + table.gsc-search-box { height: 25px; + margin:auto; + margin-top: 20px; } .gsc-control, .gsc-resultsRoot { width: 850px; } -.gsc-result -{ - padding: 6px 0; -} .gsc-search-box td, .gsc-search-box {@@ -326,26 +335,30 @@ }
.gsc-input { - width: 200px; + width: 400px; } .gsc-branding { - height: 20px; - font-size: 80%; - color: #ccc; - margin-top: -2px; + color: #000; font-style: italic; + font-size: 80%; font-family: Georgia, Serif; border: none; - text-align: right; + margin:auto; + padding: 0; +} + +td.gsc-branding-img +{ + text-align: left; } div.gsc-clear-button { background: transparent url('../images/icons/close.png') no-repeat center 50%; - width: 16px; - height: 16px; + width: 10px; + height: 10px; } div.gsc-clear-button:hover
@@ -16,6 +16,7 @@ var search_options = new google.search.SearcherOptions();
search_options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN); searchControl.addSearcher(webSearch, search_options); + searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET); searchControl.draw(document.getElementById("search_results"), draw_options);
@@ -13,11 +13,11 @@ meta[:title] = "Tag: #{name}"
meta[:type] = 'page' meta[:filters_pre] = ['erb', 'redcloth'] meta[:permalink] = name - contents = %{\n#{count} items are tagged with _#{name}_: + pl = (count == 1) ? ' is' : 's are' + contents = %{\n#{count} item#{pl} tagged with _#{name}_: <% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('#{name}')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| -dir = (pg.attributes[:type] == 'page') ? '' : '/articles' -%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %> } # Write file@@ -27,7 +27,29 @@ f.puts meta.to_yaml
f.puts "-----" f.puts contents end + end + + def write_archive_page(dir, name, count) + # Create archive page + meta = {} + meta[:title] = "Archive: #{name}" + meta[:type] = 'page' + meta[:filters_pre] = ['erb', 'redcloth'] + meta[:permalink] = name.downcase.gsub /\s/, '-' + pl = (count == 1) ? ' was' : 's were' + contents = %{\n#{count} item#{pl} written in _#{name}_: +<% articles_by_month.select{|i| i[0] == "#{name}"}[0][1].each do |pg| +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> + } + # Write file + (dir/"#{meta[:permalink]}.textile").open('w+') do |f| + f.print "--" + f.puts meta.to_yaml + f.puts "-----" + f.puts contents + end end end@@ -55,9 +77,9 @@
task :tags do site = Nanoc::Site.new(YAML.load_file('config.yaml')) site.load_data - tagdir = Pathname(Dir.pwd)/'content/tags' - tagdir.rmtree if tagdir.exist? - tagdir.mkpath + dir = Pathname(Dir.pwd)/'content/tags' + dir.rmtree if dir.exist? + dir.mkpath tags = {} # Collect tag and page data site.pages.each do |p|@@ -72,9 +94,39 @@ end
end # Write pages tags.each_pair do |k, v| - write_tag_page tagdir, k, v + write_tag_page dir, k, v + end + end + + task :archives do + site = Nanoc::Site.new(YAML.load_file('config.yaml')) + site.load_data + dir = Pathname(Dir.pwd)/'content/archives' + dir.rmtree if dir.exist? + dir.mkpath + m_articles = [] + index = -1 + current_month = "" + # Collect month and page data + articles = site.pages.select{|p| p.attributes[:date] && p.attributes[:type] == 'article'}.sort{|a, b| a.attributes[:date] <=> b.attributes[:date]}.reverse + articles.each do |a| + month = a.attributes[:date].strftime("%B %Y") + if current_month != month then + # new month + m_articles << [month, [a]] + index = index + 1 + current_month = month + else + # same month + m_articles[index][1] << a + end + end + # Write pages + m_articles.each do |m| + write_archive_page dir, m[0], m[1].length end end + task :copy_resources do pwd = Pathname.new Dir.pwd