Changeset 1326

Show
Ignore:
Timestamp:
08/07/08 20:30:36 (4 months ago)
Author:
alban
Message:

Ajout des urls des tags dans les sitemaps. Refs #17

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/helpers/application_helper.rb

    r1220 r1326  
    4141      :host => show_hostname(content.episode.show), 
    4242      :episode_slug => content.episode.slug, :content_slug => content.slug })) 
     43  end 
     44 
     45  def url_for_show_tag(show, tag, options = {}) 
     46    url_for(options.merge({ :controller => "public", :action => "tags", 
     47      :host => show_hostname(show), :search => tag.name})) 
    4348  end 
    4449 
  • trunk/app/views/sitemaps/show.rxml

    r1314 r1326  
    44    xml.tag! 'loc', url_for_show(@show, :only_path => false) 
    55    xml.tag! 'lastmod', @show.last_update_at.strftime("%Y-%m-%d") 
    6     xml.tag! 'changefreq', 'monthly' 
     6    xml.tag! 'changefreq', 'weekly' 
    77    xml.tag! 'priority', '1' 
    88  end 
     
    1212      xml.tag! 'loc', url_for_episode(episode, :only_path => false) 
    1313      xml.tag! 'lastmod', episode.updated_at.strftime("%Y-%m-%d") 
    14       xml.tag! 'changefreq', 'monthly' 
     14      xml.tag! 'changefreq', 'weekly' 
    1515      xml.tag! 'priority', '0.5' 
    1616    end 
    1717  end 
     18 
     19  for tag in @show.episodes.collect(&:tags).flatten.uniq do 
     20    xml.tag! 'url' do 
     21      xml.tag! 'loc', url_for_show_tag(@show, tag, :only_path => false) 
     22      last_episode = tag.taggings.collect(&:taggable).sort_by(&:updated_at).last 
     23      xml.tag! 'lastmod', last_episode.updated_at.strftime("%Y-%m-%d") 
     24      xml.tag! 'changefreq', 'weekly' 
     25      xml.tag! 'priority', '0.3' 
     26    end 
     27  end 
    1828end