Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

sitemap_generator dies if public dir doesn't exist yet

this tests for the presence of the public dir and creates
it if needed. This situation can arise in a new install.
  • Loading branch information...
commit e20e68139cafc04ee54c57942731bcfbec9be346 1 parent 35a158d
@masukomi masukomi authored committed
Showing with 4 additions and 0 deletions.
  1. +4 −0 plugins/sitemap_generator.rb
View
4 plugins/sitemap_generator.rb
@@ -37,6 +37,7 @@
# Modified for Octopress by John W. Long
#
require 'rexml/document'
+require 'fileutils'
module Jekyll
@@ -122,6 +123,9 @@ def generate(site)
sitemap.add_element(urlset)
# File I/O: create sitemap.xml file and write out pretty-printed XML
+ unless File.exists?(site.dest)
+ FileUtils.mkdir_p(site.dest)
+ end
file = File.new(File.join(site.dest, SITEMAP_FILE_NAME), "w")
formatter = REXML::Formatters::Pretty.new(4)
formatter.compact = true
Please sign in to comment.
Something went wrong with that request. Please try again.