Quantcast
Channel: Sitemap doesn't show as xml - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by B2K for Sitemap doesn't show as xml

$
0
0

Here's what we do to generate the sitemap for autoquoter.com. See http://www.autoquoter.com/aq/sitemap.xml

        var sitemap = new XDocument(            new XDeclaration("1.0", "utf-8", "yes"),            new XProcessingInstruction("xml-stylesheet","type=\"text/xsl\" href=\""+ Url.AbsoluteAction("SitemapXsl", "Default") +"\""),            new XElement(ns +"urlset",                new XAttribute(XNamespace.Xmlns +"sitemap", ns),                new XAttribute(XNamespace.Xmlns +"xhtml", xhtml),                 nodeList));        Response.AddHeader("X-Robots-Tag","noindex");        return Content(sitemap.Declaration+"\r\n"+sitemap, "text/xml");

We also use an xsl stylesheet to transform the sitemap. This helps with browsers that don't provide a decent formatter automatically. See http://www.autoquoter.com/aq/en/Default/SitemapXsl for the stylesheet that we are using.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>