Skip to content

Commit

Permalink
Further changes on #1162 fixing RSS validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
skoshelev committed Feb 12, 2016
1 parent 4cdfb4f commit 0d1e0bb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/Presentation/Nop.Web/Controllers/BlogController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public ActionResult ListRss(int languageId)
string.Format("{0}: Blog", _storeContext.CurrentStore.GetLocalized(x => x.Name)),
"Blog",
new Uri(_webHelper.GetStoreLocation(false)),
_webHelper.GetThisPageUrl(false),
string.Format("urn:store:{0}:blog", _storeContext.CurrentStore.Id),
DateTime.UtcNow);

if (!_blogSettings.Enabled)
Expand All @@ -234,7 +234,7 @@ public ActionResult ListRss(int languageId)
foreach (var blogPost in blogPosts)
{
string blogPostUrl = Url.RouteUrl("BlogPost", new { SeName = blogPost.GetSeName(blogPost.LanguageId, ensureTwoPublishedLanguages: false) }, "http");
items.Add(new SyndicationItem(blogPost.Title, blogPost.Body, new Uri(blogPostUrl), String.Format("Blog:{0}", blogPost.Id), blogPost.CreatedOnUtc));
items.Add(new SyndicationItem(blogPost.Title, blogPost.Body, new Uri(blogPostUrl), String.Format("urn:store:{0}:blog:post:{1}", _storeContext.CurrentStore.Id, blogPost.Id), blogPost.CreatedOnUtc));
}
feed.Items = items;
return new RssActionResult { Feed = feed };
Expand Down
8 changes: 4 additions & 4 deletions src/Presentation/Nop.Web/Controllers/BoardsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public ActionResult ActiveDiscussionsRss(int forumId = 0)
string.Format(feedTitle, _storeContext.CurrentStore.GetLocalized(x => x.Name)),
feedDescription,
new Uri(url),
_webHelper.GetThisPageUrl(false),
string.Format("urn:store:{0}:activeDiscussions", _storeContext.CurrentStore.Id),
DateTime.UtcNow);

var items = new List<SyndicationItem>();
Expand All @@ -289,7 +289,7 @@ public ActionResult ActiveDiscussionsRss(int forumId = 0)
string content = String.Format("{2}: {0}, {3}: {1}", topic.NumReplies.ToString(), topic.Views.ToString(), repliesText, viewsText);

items.Add(new SyndicationItem(topic.Subject, content, new Uri(topicUrl),
String.Format("Topic:{0}", topic.Id), (topic.LastPostTime ?? topic.UpdatedOnUtc)));
String.Format("urn:store:{0}:activeDiscussions:topic:{1}", _storeContext.CurrentStore.Id, topic.Id), (topic.LastPostTime ?? topic.UpdatedOnUtc)));
}
feed.Items = items;

Expand Down Expand Up @@ -391,7 +391,7 @@ public ActionResult ForumRss(int id)
string.Format(feedTitle, _storeContext.CurrentStore.GetLocalized(x => x.Name), forum.Name),
feedDescription,
new Uri(url),
_webHelper.GetThisPageUrl(false),
string.Format("urn:store:{0}:forum", _storeContext.CurrentStore.Id),
DateTime.UtcNow);

var items = new List<SyndicationItem>();
Expand All @@ -404,7 +404,7 @@ public ActionResult ForumRss(int id)
string topicUrl = Url.RouteUrl("TopicSlug", new { id = topic.Id, slug = topic.GetSeName() }, "http");
string content = string.Format("{2}: {0}, {3}: {1}", topic.NumReplies.ToString(), topic.Views.ToString(), repliesText, viewsText);

items.Add(new SyndicationItem(topic.Subject, content, new Uri(topicUrl), String.Format("Topic:{0}", topic.Id),
items.Add(new SyndicationItem(topic.Subject, content, new Uri(topicUrl), String.Format("urn:store:{0}:forum:topic:{1}", _storeContext.CurrentStore.Id, topic.Id),
(topic.LastPostTime ?? topic.UpdatedOnUtc)));
}

Expand Down
4 changes: 2 additions & 2 deletions src/Presentation/Nop.Web/Controllers/NewsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public ActionResult ListRss(int languageId)
string.Format("{0}: News", _storeContext.CurrentStore.GetLocalized(x => x.Name)),
"News",
new Uri(_webHelper.GetStoreLocation(false)),
_webHelper.GetThisPageUrl(false),
string.Format("urn:store:{0}:news}", _storeContext.CurrentStore.Id),
DateTime.UtcNow);

if (!_newsSettings.Enabled)
Expand All @@ -218,7 +218,7 @@ public ActionResult ListRss(int languageId)
foreach (var n in newsItems)
{
string newsUrl = Url.RouteUrl("NewsItem", new { SeName = n.GetSeName(n.LanguageId, ensureTwoPublishedLanguages: false) }, "http");
items.Add(new SyndicationItem(n.Title, n.Short, new Uri(newsUrl), String.Format("Blog:{0}", n.Id), n.CreatedOnUtc));
items.Add(new SyndicationItem(n.Title, n.Short, new Uri(newsUrl), String.Format("urn:store:{0}:news:blog:{1}", _storeContext.CurrentStore.Id, n.Id), n.CreatedOnUtc));
}
feed.Items = items;
return new RssActionResult { Feed = feed };
Expand Down
4 changes: 2 additions & 2 deletions src/Presentation/Nop.Web/Controllers/ProductController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ public ActionResult NewProductsRss()
string.Format("{0}: New products", _storeContext.CurrentStore.GetLocalized(x => x.Name)),
"Information about products",
new Uri(_webHelper.GetStoreLocation(false)),
_webHelper.GetThisPageUrl(false),
string.Format("urn:store:{0}:newProducts", _storeContext.CurrentStore.Id),
DateTime.UtcNow);

if (!_catalogSettings.NewProductsEnabled)
Expand All @@ -1197,7 +1197,7 @@ public ActionResult NewProductsRss()
string productUrl = Url.RouteUrl("Product", new { SeName = product.GetSeName() }, "http");
string productName = product.GetLocalized(x => x.Name);
string productDescription = product.GetLocalized(x => x.ShortDescription);
var item = new SyndicationItem(productName, productDescription, new Uri(productUrl), String.Format("NewProduct:{0}", product.Id), product.CreatedOnUtc);
var item = new SyndicationItem(productName, productDescription, new Uri(productUrl), String.Format("urn:store:{0}:newProducts:product:{1}", _storeContext.CurrentStore.Id, product.Id), product.CreatedOnUtc);
items.Add(item);
//uncomment below if you want to add RSS enclosure for pictures
//var picture = _pictureService.GetPicturesByProductId(product.Id, 1).FirstOrDefault();
Expand Down

0 comments on commit 0d1e0bb

Please sign in to comment.