From 65d3a0c84f7a42805adbbfa712c24bf34eb54fb0 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Mon, 20 Oct 2014 11:24:52 -0700 Subject: [PATCH] Be a bit safer about checking source_file in Sitemap Preview. Working towards fixing #1166 --- .../lib/middleman-core/meta_pages/sitemap_resource.rb | 2 +- .../lib/middleman-core/sitemap/extensions/redirects.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb b/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb index e42176df..9d1d1ec0 100644 --- a/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb +++ b/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb @@ -39,7 +39,7 @@ module Middleman build_path = 'Not built' if ignored? props['Build Path'] = build_path if @resource.path != build_path props['URL'] = content_tag(:a, @resource.url, href: @resource.url) unless ignored? - props['Source File'] = @resource.source_file.sub(/^#{Regexp.escape(ENV['MM_ROOT'] + '/')}/, '') + props['Source File'] = @resource.source_file ? @resource.source_file.sub(/^#{Regexp.escape(ENV['MM_ROOT'] + '/')}/, '') : 'Dynamic' data = @resource.data props['Data'] = data.inspect unless data.empty? diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb b/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb index fdf1315f..fe34ec39 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb @@ -66,6 +66,10 @@ module Middleman super(store, path) end + def get_source_file + nil + end + def template? true end