I having difficulty to use the MVCSitemapProvider to generate a sitemap my case is this:
I have this :
routes.MapRoute("Blog", "Blog/{id}/{seoName}", new { controller = "Blog", action = "ViewBlog", seoName = "" }, new { id = @"^\d+$" });
and I am using this as a atribute to my controller
[MvcSiteMapNode(Title = "Blog", Key = "ViewBlog", ParentKey = "Blog",Route="Blog")]
the issue is the sitemap.xml contains this :
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://localhost:7872/</loc>
</url>
<url>
<loc>http://localhost:7872/#</loc>
</url>
<url>
<loc>http://localhost:7872/Blog</loc>
</url>
<url>
<loc>http://localhost:7872/Home/About</loc>
</url>
</urlset>
My route is mapping to this URL : <loc>http://localhost:7872/#</loc> when I use the route=Blog
It was supposed to be something like this : localhost:7872/blog/idhere/friendurlName
the URL works fine, but I am trying to improve SEO and Sitemap is pretty much necessary I am not sure how to set this up. any ideas?
You should use a a dynamic node provider to make each blog post into a separate node. You also need to register the "id" and "seoName" route parameters with MvcSiteMapProvider or it will not be able to match the route or build the correct URL.
And in a code file in your project...