To served back an xml file you'd probably want to use proper mimetype
text/xml, or application/xml.

Id' recommend using DispatchPf. In Boot:

val dispatcher: LiftRules.DispatchPF = {
        case Req("sitemap" :: Nil, "xml", _) => () => Full(new
XmlResponse(<cities>
  <city name="Boston"/>
  <city name="New York"/>
  <city name="San Francisco"/>
  <city name="Dallas"/>
  <city name="Chicago"/>
  </cities>)
    }

 LiftRules.dispatch.prepend(dispatcher);

On Feb 28, 3:03 am, Bob Folkerts <robertfolke...@gmail.com> wrote:
> I'm trying to add robots.txt and a sitemap.xml to a web site.  My
> Boot.scala has a snippet that looks like
>
>     val entries =   Menu(Loc("Home", List("index"), "Home")) ::
>                     galleryMenu :: servingYouMenu ::
> socialSitesMenu :: aboutUsMenu ::
>                     Menu(Loc("ContactUs", List("ContactUs"), "Contact
> Us")) ::
>                     Menu(Loc("robots", List("robots.txt"),
> "robots.txt", Hidden)) ::
>                     Menu(Loc("sitemap", List("sitemap.xml"),
> "sitemap.xml", Hidden)) ::Nil
>
> The robots.txt file shows up right away, but I get a 404 when I try to
> access /sitemap.xml .  I have a static sitemap.xml that I want to
> include.  I tried this as a static xml file in the webapp directory.
> I also tried it without the explicit '.xml', but I had the same
> results.  I tried to make it look more like my html, so I added a
> sitemap-tempate.xml in templates-hidden and had the sitemap.xml
> reference that.
>
> Eventually, I would like to generate the sitemap.xml from the SiteMap
> assuming that the user has not logged into the application.  I would
> also assume that for most users, a default robots.txt would be easy to
> generate.  This seems like something of general utility that would be
> a good chance to learn more about Lift.
>
> Can anyone explain how to display the simple, static sitemap.xml.  I'm
> sure this is a newbie mistake, but I'm not seeing it on my own.

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to