1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00
middleman--middleman/lib/middleman/core_extensions/sitemap.rb
2011-11-27 22:04:19 -08:00

44 lines
No EOL
901 B
Ruby

require "active_support/core_ext/hash/deep_merge"
require 'find'
module Middleman::CoreExtensions::Sitemap
class << self
def registered(app)
app.send :include, InstanceMethods
end
alias :included :registered
end
module InstanceMethods
def initialize
super
file_changed do |file|
sitemap.touch_file(file)
end
file_deleted do |file|
sitemap.remove_file(file)
end
end
def sitemap
@sitemap ||= ::Middleman::Sitemap::Store.new(self)
end
# Keep a path from building
def ignore(path)
sitemap.ignore(path)
end
def reroute(url, target)
sitemap.proxy(url, target)
end
def provides_metadata(matcher=nil, &block)
@_provides_metadata ||= []
@_provides_metadata << [block, matcher] if block_given?
@_provides_metadata
end
end
end