title: How to render sitemap.xml in rails app
body: <p>I have added /views/sitemap/index.xml and want it displayed when i go to the relevant url.</p>
  
  <pre><code>class SitemapController &lt; ApplicationController
  
    def index
      respond_to do |format|
        format.html
        format.xml
      end
    end
  
  end
  </code></pre>
  
  <p>And in routes.rb</p>
  
  <pre><code>  match "sitemap/" =&gt; "sitemap#index"
  </code></pre>
  
  <p>Using Rails 3</p>
  
  <p>When I go to mydomain.com/sitemap/ I just get a white page. Any ideas?</p>
  
  <p>index.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;urlset
        xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
              http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"&gt;
  
  &lt;url&gt;
    &lt;loc&gt;http://www.mydomain.com/&lt;/loc&gt;
    &lt;changefreq&gt;weekly&lt;/changefreq&gt;
  &lt;/url&gt;
  &lt;/urlset&gt;
  </code></pre>