diff --git a/middleman-core/lib/middleman-core/sitemap/page.rb b/middleman-core/lib/middleman-core/sitemap/page.rb index c8886e36..8b25b084 100644 --- a/middleman-core/lib/middleman-core/sitemap/page.rb +++ b/middleman-core/lib/middleman-core/sitemap/page.rb @@ -192,8 +192,9 @@ module Middleman::Sitemap # This path can be affected by proxy callbacks. # @return [String] def destination_path - # TODO: memoize this value - store.reroute_callbacks.inject(self.path) do |destination, callback| + # memoizing this means that reroute callbacks should be in place before the sitemap + # gets built + @destination_path ||= store.reroute_callbacks.inject(self.path) do |destination, callback| callback.call(destination, self) end end