0

I'm working on a site that converts articles into RSS using SyndicationItem. My problem is that the Authors (SyndicationPerson) is showing the email address only (if it exists) otherwise the name only as following: If email exists:

<author>name@email.com</author>

if emails is missing:

<author>
  <name>First Name Last Name</name>
</author>

It is supposed to show both:

<author>
   <name></name>
   <email></email>
</author>

So what controls this or is there something missing?

Parts of the code that matter:

var syndicationItem = new SyndicationItem(GetItemTitle(article), GetItemSummary(article), new Uri(articleUrl), article.AbsoluteUrl, article.Date);
syndicationItem = AddAuthorsToFeedItem(syndicationItem, article);
syndicationItems.Add(syndicationItem);
feed.Items = syndicationItems;

var output = new StringBuilder();

using (var writer = XmlWriter.Create(output, new XmlWriterSettings {Indent = true}))
{
    feed.SaveAsRss20(writer);
    writer.Flush();
    writer.Close();
    return output.ToString();
}




private SyndicationItem AddAuthorsToFeedItem(SyndicationItem syndicationItem, Article article)
        {
            foreach (var author in article.Authors)
            {
                var authorName = author.First_Name + " " + author.Last_Name;
                var person = new SyndicationPerson(author.Email_Address, authorName, string.Empty);
                syndicationItem.Authors.Add(person);
            }
            return syndicationItem;
        }
TamerM
  • 722
  • 7
  • 25

0 Answers0