Sha256: 3a9e5e96c06ec2423d1ee5f6e322d29bbdbade223089966eb7fe9dff18f0861b
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
require "massive_sitemap/builder/base" module MassiveSitemap module Builder class Index < Base HEADER_NAME = 'sitemapindex' HEADER_ATTRIBUTES = { :xmlns => 'http://www.sitemaps.org/schemas/sitemap/0.9' } def initialize(writer, options = {}, &block) writer.set(:force_overwrite => true) super(writer, options) do writer.each do |path, last_modified| init_writer! next if writer.current && path.include?(writer.current) add path, :last_modified => last_modified end end end def self.generate(writer, options = {}, &block) index_url(super, writer) end def self.index_url(builder, writer) writer.current && ::File.join(builder.send(:url), writer.current) end def add_url!(location, attrs = {}) init_writer! tag! 'sitemap' do tag! 'loc', location tag! 'lastmod', attrs[:last_modified].utc.strftime('%Y-%m-%dT%H:%M:%S+00:00') if attrs[:last_modified] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
massive_sitemap-2.0.0.rc6 | lib/massive_sitemap/builder/index.rb |
massive_sitemap-2.0.0.rc5 | lib/massive_sitemap/builder/index.rb |