Started upgrade to Nanoc3, tidying up site:tags task.
h3rald h3rald@h3rald.com
Thu, 15 Apr 2010 15:33:20 +0200
44 files changed,
105 insertions(+),
49 deletions(-)
jump to
M
config.yaml
→
config.yaml
@@ -2,10 +2,28 @@ ---
data_sources: - items_root: / layouts_root: / - type: filesystem_combined + type: filesystem_unified +text_extensions: +- css +- erb +- haml +- htm +- html +- js +- less +- markdown +- md +- php +- rb +- sass +- txt +- xml +- textile +- bbcode +- glyph output_dir: output base_url: "http://www.h3rald.com" author_name: "Fabio Cevasco" author_email: "h3rald@h3rald.com" -dev: false +dev: true
M
tasks/site.rake
→
tasks/site.rake
@@ -31,8 +31,6 @@ task :tags do
site = Nanoc3::Site.new('.') site.load_data dir = Pathname(Dir.pwd)/'content/tags' - dir.rmtree if dir.exist? - dir.mkpath tags = {} # Collect tag and page data site.items.each do |p|@@ -47,9 +45,20 @@ end
end # Write pages tags.each_pair do |k, v| - write_tag_page dir, k, v - write_tag_feed_page dir, k, 'RSS' - write_tag_feed_page dir, k, 'Atom' + unless (dir/"#{k}.textile").exist? && (dir/"#{k}-rss.xml").exist? && (dir/"#{k}-atom.xml").exist? then + puts "Creating tag pages for '#{k}'" + write_tag_page dir, k, v + write_tag_feed_page dir, k, 'RSS' + write_tag_feed_page dir, k, 'Atom' + end + end + # Remove unused tags + dir.children.each do |c| + t = c.basename.to_s.gsub /(-(rss|atom))?\..+$/, '' + unless tags[t] then + puts "Deleting unused tag page '#{c.basename}'" + c.delete + end end end