From 3389c6d508acf0982c28132d299a8a5838f0f50b Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 28 Jun 2011 02:31:42 -0700 Subject: [PATCH] Sometimes wp:post_name can be empty (e.g. when a post is still draft), in this case we make up an appropriate permalink_title that will be used as the filename. The importer can always rename the file later on, and at least the file is unlikely to have been overwritten by another draft on the same day. --- lib/jekyll/migrators/wordpressdotcom.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/jekyll/migrators/wordpressdotcom.rb b/lib/jekyll/migrators/wordpressdotcom.rb index 62187a77..e8b5debe 100644 --- a/lib/jekyll/migrators/wordpressdotcom.rb +++ b/lib/jekyll/migrators/wordpressdotcom.rb @@ -19,6 +19,11 @@ module Jekyll (doc/:channel/:item).each do |item| title = item.at(:title).inner_text.strip permalink_title = item.at('wp:post_name').inner_text + # Fallback to "prettified" title if post_name is empty (can happen) + if permalink_title == "" + permalink_title = title.downcase.split.join('-') + end + date = Time.parse(item.at('wp:post_date').inner_text) status = item.at('wp:status').inner_text type = item.at('wp:post_type').inner_text