http://www.mikesdotnetting.com/Article/111/RSS-Feeds-and-Google-Sitemaps-for-ASP.NET-MVC-with-LINQ-To-XML
http://stackoverflow.com/questions/884660/how-to-create-google-sitemap-for-mvc-site
http://www.google.com/support/webmasters/bin/answer.py?answer=183668 --sitemap format
http://www.itivy.com/ivy/archive/2011/2/15/634334029665781153.html ---RSS Feed
FunnyDataContext context = new FunnyDataContext();
public ContentResult
Sitemap()
{
XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9";
const string url = "http://www.suhow.com/Video/Detail?title={0}";
var list = context.Videos.ToList();
var sitemap = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
new XElement(ns + "urlset",
from item in list
select
new XElement("url",
new XElement("loc", string.Format(url, item.Title)),
new XElement("lastmod", String.Format("{0:yyyy-MM-dd}", item.CreateTime)),
new XElement("changefreq", "monthly"),
new XElement("priority", "0.5"))));
return Content(sitemap.ToString(), "text/xml");
}
public ContentResult
Rss()
{
const string url = "http://www.suhow.com/Video/Detail?title={0}";
var list = context.Videos.ToList();
var rss = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
new XElement("rss",
new XAttribute("version", "2.0"),
new XElement("channel",
new XElement("title", "Suhow Feed"),
new XElement("link", "http://www.suhow.com/rss"),
new XElement("description", "Funny,joke,twitter,video,picture,quotains"),
new XElement("copyright", "(c)" + DateTime.Now.Year + ", Suhow. All rights reserved"),
from item in list
select
new XElement("item",
new XElement("title", item.Title),
new XElement("description", item.Description),
new XElement("link", String.Format(url, item.Title)),
new XElement("pubDate", item.CreateTime.ToString("R"))
)
)
)
);
return Content(rss.ToString(), "text/xml");
}
Finally,using
www.mysite.com/xml/sitemap to browse sitemap.xml