views:

17

answers:

0

I am using ASP.Net MVC2 and have a RSS feed for my blog. I am using out of the box functionality in System.ServiceModel.Syndication and Rss20FeedFormatter.

The feed works fine and can be read by Outlook as well as every browser I have tried. However when I submitted the RSS feed to google as a sitemap I got validation errors.
Out of curiosity I validated the feed with feedvalidator which reported similar issues.

Feed: http://www.chrispfarrell.com/Blog/Rss

If you pop this feed in at feedvalidator.org you will see the problems.

There is really no custom code going on to generate the RSS.

The controller action is

public FeedResult Rss()
        {
            const string baseUrl = "http://www.chrispfarrell.com/Blog/View/";

            var blogs = _blogService.GetBlogs();
            var feed = new SyndicationFeed
                           {
                               Title = new TextSyndicationContent("Chris Farrell"),
                               Copyright = new TextSyndicationContent("Copywrite Chris Farrell 2010")
                           };

            var postItems = blogs.Take(25)
                .Select(p => new SyndicationItem(p.Title,p.Body,new Uri(baseUrl + p.BlogUrl))
                                 {
                                     PublishDate = p.DateCreated,
                                 });

            feed.Items = postItems;
            return new FeedResult(new Rss20FeedFormatter(feed));
        }  

Any comments as to why the feed would not be valid and well formed? I can post the code for FeedResult if needed but its pretty standard code.

Thanks

Chris Farrell