Sha256: 5728c9be8cb8167a8b252a07a2aa614da534ea7e0fde13c3cbc5c2eb2e8bea6e

Contents?: true

Size: 819 Bytes

Versions: 16

Compression:

Stored size: 819 Bytes

Contents

require 'builder'

module SitemapGenerator
  module Builder
    class SitemapIndexUrl < SitemapUrl

      def initialize(path, options={})
        if index = path.is_a?(SitemapGenerator::Builder::SitemapIndexFile) && path
          options.reverse_merge!(:host => index.location.host, :lastmod => Time.now, :changefreq => 'always', :priority => 1.0)
          path = index.location.path_in_public
          super(path, options)
        else
          super
        end
      end

      # Return the URL as XML
      def to_xml(builder=nil)
        builder = ::Builder::XmlMarkup.new if builder.nil?
        builder.sitemap do
          builder.loc        self[:loc]
          builder.lastmod    w3c_date(self[:lastmod])   if self[:lastmod]
        end
        builder << '' # force to string
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sitemap_generator-2.2.1 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.1.8 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.1.7 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.1.7.pre1 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.1.6 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.1.5 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.1.4 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.1.3 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.1.2 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.1.1 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.1.0 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.0.1.pre2 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.0.1.pre1 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.0.1 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-2.0.0 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-1.5.2 lib/sitemap_generator/builder/sitemap_index_url.rb