From 3ab7658d1f62b75265d3f3cd03a561c54e1be3ab Mon Sep 17 00:00:00 2001 From: Stephen McDonald Date: Wed, 28 Dec 2011 08:16:19 +1100 Subject: [PATCH] Fixed Tumblr URL redirects. --- lib/jekyll/migrators/tumblr.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/jekyll/migrators/tumblr.rb b/lib/jekyll/migrators/tumblr.rb index 0c6402ab..2a2a3034 100644 --- a/lib/jekyll/migrators/tumblr.rb +++ b/lib/jekyll/migrators/tumblr.rb @@ -110,6 +110,9 @@ module Jekyll site = Jekyll::Site.new(Jekyll.configuration({})) dir = File.join(File.dirname(__FILE__), "..") urls = Hash[posts.map { |post| + # Create an initial empty file for the post so that + # we can instantiate a post object. + File.open("_posts/tumblr/#{post[:name]}", "w") tumblr_url = URI.parse(post[:slug]).path jekyll_url = Jekyll::Post.new(site, dir, "", "tumblr/" + post[:name]).url redirect_dir = tumblr_url.sub(/\//, "") + "/"