Fixed Tumblr URL redirects.

This commit is contained in:
Stephen McDonald 2011-12-28 08:16:19 +11:00
parent 886b9740f2
commit 3ab7658d1f
1 changed files with 3 additions and 0 deletions

View File

@ -110,6 +110,9 @@ module Jekyll
site = Jekyll::Site.new(Jekyll.configuration({})) site = Jekyll::Site.new(Jekyll.configuration({}))
dir = File.join(File.dirname(__FILE__), "..") dir = File.join(File.dirname(__FILE__), "..")
urls = Hash[posts.map { |post| 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 tumblr_url = URI.parse(post[:slug]).path
jekyll_url = Jekyll::Post.new(site, dir, "", "tumblr/" + post[:name]).url jekyll_url = Jekyll::Post.new(site, dir, "", "tumblr/" + post[:name]).url
redirect_dir = tumblr_url.sub(/\//, "") + "/" redirect_dir = tumblr_url.sub(/\//, "") + "/"