Exemplo n.º 1
0
        private List<SyndicationItem> GetRecentPagesOrPosts(RSSFeedInclude feedData)
        {
            List<SyndicationItem> syndRSS = new List<SyndicationItem>();
            List<SiteNav> lst = new List<SiteNav>();

            ContentPageType PageType = new ContentPageType();

            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                if (feedData == RSSFeedInclude.PageOnly || feedData == RSSFeedInclude.BlogAndPages) {
                    List<SiteNav> lst1 = navHelper.GetLatest(this.SiteID, 8, true);
                    lst = lst.Union(lst1).ToList();
                    List<SiteNav> lst2 = navHelper.GetLatestUpdates(this.SiteID, 10, true);
                    lst = lst.Union(lst2).ToList();
                }
                if (feedData == RSSFeedInclude.BlogOnly || feedData == RSSFeedInclude.BlogAndPages) {
                    List<SiteNav> lst1 = navHelper.GetLatestPosts(this.SiteID, 8, true);
                    lst = lst.Union(lst1).ToList();
                    List<SiteNav> lst2 = navHelper.GetLatestPostUpdates(this.SiteID, 10, true);
                    lst = lst.Union(lst2).ToList();
                }
            }

            lst.RemoveAll(x => x.ShowInSiteMap == false && x.ContentType == ContentPageType.PageType.ContentEntry);
            lst.RemoveAll(x => x.BlockIndex == true);

            foreach (SiteNav sn in lst) {
                SyndicationItem si = new SyndicationItem();

                string sPageURI = RemoveDupeSlashesURL(this.ConstructedCanonicalURL(sn));

                Uri PageURI = new Uri(sPageURI);

                si.Content = new TextSyndicationContent(sn.PageTextPlainSummaryMedium);
                si.Title = new TextSyndicationContent(sn.NavMenuText);
                si.Links.Add(SyndicationLink.CreateSelfLink(PageURI));
                si.AddPermalink(PageURI);

                si.LastUpdatedTime = sn.EditDate;
                si.PublishDate = sn.CreateDate;

                syndRSS.Add(si);
            }

            return syndRSS.OrderByDescending(p => p.PublishDate).ToList();
        }