lib/jekyll-sitemap.rb in jekyll-sitemap-0.6.2 vs lib/jekyll-sitemap.rb in jekyll-sitemap-0.6.3
- old
+ new
@@ -32,11 +32,15 @@
File.expand_path "sitemap.xml", File.dirname(__FILE__)
end
# Destination for sitemap.xml file within the site source directory
def destination_path
- @site.in_dest_dir("sitemap.xml")
+ if @site.respond_to?(:in_dest_dir)
+ @site.in_dest_dir("sitemap.xml")
+ else
+ Jekyll.sanitized_path(@site.dest, "sitemap.xml")
+ end
end
# copy sitemap template from source to destination
def write
FileUtils.mkdir_p File.dirname(destination_path)
@@ -51,9 +55,13 @@
site_map.output.gsub(/[\s\n]*\n+/, "\n")
end
# Checks if a sitemap already exists in the site source
def sitemap_exists?
- File.exists? @site.in_source_dir("sitemap.xml")
+ if @site.respond_to?(:in_source_dir)
+ File.exists? @site.in_source_dir("sitemap.xml")
+ else
+ File.exists? Jekyll.sanitized_path(@site.source, "sitemap.xml")
+ end
end
end
end