Creating XML with Haml

yashiro

New Member
I'm trying to make a dynamic sitemap for my CMS-style rails app, but I am having trouble creating a sitemap in XML using Haml. I looked at the docs and they say that I should be able to use \[code\]!!! XML\[/code\] to insert the \[code\]<?xml version="1.0" encoding="UTF-8"?>\[/code\] tag at the beginning of the document. When I try to do this, it does not render anything at all and I am forced to use a literal meta-xml tag. What am I doing wrong?\[code\]content_controller.rb=====================class ContentController < ApplicationController # other methods def sitemap @sections = Section.all :include => :pages respond_to do |format| format.xml end endendsitemap.xml.haml================<?xml version="1.0" encoding="UTF-8"?>-# !!! XML-# the above tag does not work%urlset{:xmlns => 'http://www.sitemaps.org/schemas/sitemap/0.9'} %url %loc= root_url - @sections.each do |section| - section.pages.each do |page| %url %loc= "#{root_url}#{section.url}/#{page.url}" %lastmod= page.updated_at\[/code\]
 
Back
Top