Feature #2646 » sitemaps.01.patch
| app/controllers/robots_controller.rb (révision 0) | ||
|---|---|---|
|
class RobotsController < ApplicationController
|
||
|
def sitemaps
|
||
|
@projects = Project.all
|
||
|
render :layout => false, :content_type => 'text/plain'
|
||
|
end
|
||
|
end
|
||
|
|
||
| app/views/robots/sitemaps.rhtml (révision 0) | ||
|---|---|---|
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||
|
<%
|
||
|
@projects.each do |p|
|
||
|
if p.wiki != nil
|
||
|
p.wiki.pages.each do |wp|
|
||
|
-%>
|
||
|
<url>
|
||
|
<loc><%= url_for(:controller => 'wiki', :only_path => false) + "/#{p.identifier}/#{wp.title}" -%></loc>
|
||
|
<lastmod><%= wp.content.updated_on.strftime("%Y-%m-%d") -%></lastmod>
|
||
|
</url>
|
||
|
<%
|
||
|
end
|
||
|
end
|
||
|
end -%>
|
||
|
</urlset>
|
||
| config/routes.rb (copie de travail) | ||
|---|---|---|
|
|
||
|
# Install the default route as the lowest priority.
|
||
|
map.connect ':controller/:action/:id'
|
||
|
map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
|
||
|
map.connect 'sitemaps.xml', :controller => 'robots', :action => 'sitemaps'
|
||
|
end
|
||