Permalink
Browse files

adjusted sitemap.xml builder

  • Loading branch information...
1 parent 9e4d741 commit 4655a0d5cc11354a47b9c519736486c6edf58f85 @mattpolito committed Feb 1, 2011
Showing with 19 additions and 17 deletions.
  1. +1 −2 app/controllers/sitemap_controller.rb
  2. +18 −15 app/views/sitemap/show.xml.builder
View
3 app/controllers/sitemap_controller.rb
@@ -2,9 +2,8 @@ class SitemapController < ApplicationController
def show
respond_to do |format|
format.xml do
- @presentations = Presentation.released
@speakers = Speaker.all
- @events = Event.all
+ @events = Event.order("updated_at DESC")
@tags = ActsAsTaggableOn::Tag.all
end
end
View
33 app/views/sitemap/show.xml.builder
@@ -3,15 +3,26 @@ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
xml.url do
xml.loc "http://getconfed.com"
+ xml.changefreq "daily"
xml.priority 1.0
end
- unless @presentations.blank?
- @presentations.each do |presentation|
+ unless @events.blank?
+ @events.each do |event|
xml.url do
- xml.loc event_presentation_url(presentation.event, presentation)
- xml.lastmod presentation.updated_at.to_date
- xml.priority 0.9
+ xml.loc event_url(event)
+ xml.lastmod event.updated_at.to_date
+ xml.changefreq "weekly"
+ xml.priority 0.7
+ end
+
+ event.presentations.released.each do |presentation|
+ xml.url do
+ xml.loc event_presentation_url(presentation.event, presentation)
+ xml.lastmod presentation.updated_at.to_date
+ xml.changefreq "weekly"
+ xml.priority 0.9
+ end
end
end
end
@@ -21,25 +32,17 @@ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
xml.url do
xml.loc speaker_url(speaker)
xml.lastmod speaker.updated_at.to_date
+ xml.changefreq "weekly"
xml.priority 0.8
end
end
end
- unless @events.blank?
- @events.each do |event|
- xml.url do
- xml.loc event_url(event)
- xml.lastmod event.updated_at.to_date
- xml.priority 0.7
- end
- end
- end
-
unless @tags.blank?
@tags.each do |tag|
xml.url do
xml.loc tagged_url(tag.permalink)
+ xml.changefreq "weekly"
xml.priority 0.5
end
end

0 comments on commit 4655a0d

Please sign in to comment.