Created
July 9, 2009 11:02
Revisions
-
alexyoung created this gist
Jul 9, 2009 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ namespace :tags do task :generate do puts 'Generating tags...' require 'rubygems' require 'jekyll' include Jekyll::Filters options = Jekyll.configuration({}) site = Jekyll::Site.new(options) site.read_posts('') html =<<-HTML --- layout: default title: Tags --- <h2>Tags</h2> HTML site.categories.sort.each do |category, posts| html << <<-HTML <h3 id="#{category}">#{category}</h3> HTML html << '<ul class="posts">' posts.each do |post| post_data = post.to_liquid html << <<-HTML <li> <div>#{date_to_string post.date}</div> <a href="#{post.url}">#{post_data['title']}</a> </li> HTML end html << '</ul>' end File.open('tags.html', 'w+') do |file| file.puts html end puts 'Done.' end end