File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -70,12 +70,15 @@ public List<RssItem> Items {
7070 set { _items = value ?? new List < RssItem > ( ) ; }
7171 }
7272
73+ public bool IncludeAtomLink { get ; set ; }
74+
7375 #endregion
7476
7577 #region Constructor
7678
7779 public RssFeed ( ) {
7880 Version = "2.0" ;
81+ IncludeAtomLink = true ;
7982 }
8083
8184 /// <summary>
@@ -214,6 +217,18 @@ public XDocument ToXDocument() {
214217 xRss . Add ( new XAttribute ( "version" , Version ) ) ;
215218 }
216219
220+ // Append "atom:link" to the channel (if enabled)
221+ if ( IncludeAtomLink ) {
222+ XNamespace atom = "http://www.w3.org/2005/Atom" ;
223+ xRss . Add ( new XAttribute ( XNamespace . Xmlns + "atom" , "http://www.w3.org/2005/Atom" ) ) ;
224+ xChannel . Add ( new XElement (
225+ atom + "link" ,
226+ new XAttribute ( "href" , Link ?? "" ) ,
227+ new XAttribute ( "rel" , "self" ) ,
228+ new XAttribute ( "type" , "application/rss+xml" )
229+ ) ) ;
230+ }
231+
217232 // Add the items to the channel
218233 xChannel . Add ( from item in Items orderby item . PubDate descending select item . ToXElement ( ) ) ;
219234
You can’t perform that action at this time.
0 commit comments