I'm trying to add blogPosts to the sitemap by adding following code in SitemapGenerator.cs
protected virtual IEnumerable<SitemapUrl> GetBlogUrls(UrlHelper urlHelp)
{
return _blogService.GetAllBlogPosts(storeId: 0, languageId: 0, dateFrom: null, dateTo: null, pageIndex: 0, pageSize: int.MaxValue, showHidden: false).Select (blog =>
{
var url = urlHelp.RouteUrl("Blog", new { blogPostId = blog.Id, SeName = blog.GetSeName() }, GetHttpProtocol());
return new SitemapUrl(url, UpdateFrequency.Weekly, blog.CreatedOnUtc);
});
}
But the return result is
<url>
<loc>http://localhost/blog?blogPostId=3</loc>
<changefreq>weekly</changefreq>
<lastmod>2017-05-03</lastmod>
</url>
<url>
<loc>http://localhost/blog?blogPostId=1</loc>
<changefreq>weekly</changefreq>
<lastmod>2017-04-20</lastmod>
</url>
The return number is write, but not turn to the correct URLs.
Anyone help?
Thanks