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