protected override EnclosureItem GetEnclosureFromItem(Entry item) { if (item.Enclosure != null && item.Enclosure.AddToFeed) { var enc = new EnclosureItem { Url = item.Enclosure.Url, MimeType = item.Enclosure.MimeType, Size = item.Enclosure.Size }; return(enc); } return(null); }
/// <summary> /// Writes the XML for a single entry. /// </summary> protected virtual void EntryXml(T item, BlogConfigurationSettings settings) { //core WriteElementString("title", GetTitleFromItem(item)); ICollection <string> categories = GetCategoriesFromItem(item); if (categories != null) { foreach (string category in categories) { WriteElementString("category", category); } } string fullUrl = GetLinkFromItem(item); WriteElementString("link", fullUrl); WriteElementString ( "description", //Tag string.Format ( CultureInfo.InvariantCulture, "{0}{1}", //tag def GetBodyFromItem(item), (UseAggBugs && settings.Tracking.EnableAggBugs) ? TrackingUrls.AggBugImage(GetAggBugUrl(item)) : null //use aggbugs ) ); string author = GetAuthorFromItem(item); if (!String.IsNullOrEmpty(author)) { WriteElementString("dc:creator", author); } WriteElementString("guid", GetGuid(item)); WriteElementString("pubDate", GetPublishedDateUtc(item).ToString("r", CultureInfo.InvariantCulture)); if (ItemCouldContainComments(item)) { if (AllowComments && Blog.CommentsEnabled && ItemAllowsComments(item) && !CommentsClosedOnItem(item)) { // Comment API (http://wellformedweb.org/story/9) WriteElementString("wfw:comment", GetCommentApiUrl(item)); } WriteElementString("comments", fullUrl + "#feedback"); if (GetFeedbackCount(item) > 0) { WriteElementString("slash:comments", GetFeedbackCount(item).ToString(CultureInfo.InvariantCulture)); } WriteElementString("wfw:commentRss", GetCommentRssUrl(item)); if (Blog.TrackbacksEnabled) { WriteElementString("trackback:ping", GetTrackBackUrl(item)); } } EnclosureItem encItem = GetEnclosureFromItem(item); if (encItem != null) { WriteStartElement("enclosure"); WriteAttributeString("url", encItem.Url); WriteAttributeString("length", encItem.Size.ToString(CultureInfo.InvariantCulture)); WriteAttributeString("type", encItem.MimeType); WriteEndElement(); } }