Skip to content

Instantly share code, notes, and snippets.

@lidaobing
Created June 3, 2012 14:15
Show Gist options
  • Save lidaobing/2863678 to your computer and use it in GitHub Desktop.
Save lidaobing/2863678 to your computer and use it in GitHub Desktop.
desc 'Generate tags page'
task :tags do
puts "Generating tags..."
require 'rubygems'
require 'jekyll'
include Jekyll::Filters
options = Jekyll.configuration({})
site = Jekyll::Site.new(options)
site.read_posts('')
site.tags.sort.each do |tag, posts|
html = <<-HTML
---
layout: tag_index
tag_name: "#{tag}"
title: Postings tagged "#{tag}"
---
HTML
File.open("tags/#{tag}.html", 'w+') do |file|
file.puts html
end
end
puts 'Done.'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment