I wrote a sitemap controller and view but my index.xml.builder file is 
actually an html response not xml because that what google's site says I 
did a lot of searching but all the examples I find are how to render a 
resource as xml from a controller action but I'm trying to use an 
action/view pair "index" 

sitemap_controller.rb:
xml.instruct!
xml.urlset(:xmlns => "http://www.sitemaps.org/schemas/sitemap/0.9";,
           "xmlns:xsi"=> "http://www.w3.org/2001/XMLSchema-instance";,
            "xsi:schemaLocation"=>"
http://www.sitemaps.org/schemas/sitemap/0.9 
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd";) do
  # whatever logic your app has, e.g. static pages:
  @people.each do |person|
    xml.url do
      xml.loc person_url(person)
      xml.lastmod page.updated_at.to_date.to_s(:db)
      xml.changefreq "monthly"
      xml.priority 0.3
    end
  end
end

index.xml.builder:
xml.instruct!
xml.urlset(:xmlns => "http://www.sitemaps.org/schemas/sitemap/0.9";,
           "xmlns:xsi"=> "http://www.w3.org/2001/XMLSchema-instance 
<http://www.google.com/url?q=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&sa=D&sntz=1&usg=AFQjCNFERp6A_kcvqihMCKJ7EHX8O14vIA>
",
            "xsi:schemaLocation"=>"
http://www.sitemaps.org/schemas/sitemap/0.9 
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd";) do
  # whatever logic your app has, e.g. static pages:
  @people.each do |person|
    xml.url do
      xml.loc person_url(person)
      xml.lastmod page.updated_at.to_date.to_s(:db)
      xml.changefreq "monthly"
      xml.priority 0.3
    end
  end
end

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a9b363cf-cf34-44a3-a5c7-d1a34267ff1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to