Sha256: da1c50e6a51858c9f1b1ff8c9dd989a41b1c3a4edecde4f0496feb430dbddd98

Contents?: true

Size: 908 Bytes

Versions: 5

Compression:

Stored size: 908 Bytes

Contents

== About XmlSitemap

XmlSitemap is a gem to build website XML sitemaps.

== How To Use

require 'rubygems'
require 'xml-sitemap'

== Example

# Somewhere in controller

pages = Page.all(:order => [:updated_at.desc] # DM model

@map = XmlSitemap::Map.new('somedomain.com') do |m|
  m.add(:url => '/', :period => :daily, :priority => 1.0)
  m.add(:url => '/contractors', :period => :daily, :priority => 1.0)
  pages.each do |p|
    m.add(
      :url => url_for_page(p),
      :updated => p.updated_at,
      :priority => 0.5,
      :period => :never
    )
  end
end

# ... then render it in your view
<%= @map.render %>

== Options

:url - page path, relative to domain (ex.: /test), String.
:period - freqchange attribute, Symbol, :none, :never, :always, :hourly, :daily, :weekly, :monthly, :yearly
:priority - priority attribute, Float class,(0.0..1.0)
:updated - (optional) last_update attribute, Time class

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xml-sitemap-1.0.5 README
xml-sitemap-1.0.4 README
xml-sitemap-1.0.3 README
xml-sitemap-1.0.2 README
xml-sitemap-1.0.1 README