Skip to content

Commit

Permalink
adding xml sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
tkriplean committed Oct 11, 2011
1 parent aaebbe5 commit 9431eb0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/controllers/options_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ def show
end

def index
headers['Content-Type'] = 'application/xml'

@options = Option.all
respond_to do |format|
format.xml { } # sitemap is a named scope
format.html { }
end

end

end
8 changes: 8 additions & 0 deletions app/views/options/index.xml.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- base_url = "http://#{request.host_with_port}"
!!! XML
%urlset{:xmlns => "http://www.sitemaps.org/schemas/sitemap/0.9"}
- for option in @options
%url
%loc #{option_url(option)}
%changefreq never
%priority 0.5

0 comments on commit 9431eb0

Please sign in to comment.