public override List <SitemapUrl> GetUrls(int portalId, PortalSettings ps, string version) { var listOfUrls = new List <SitemapUrl>(); foreach (Article ai in ArticleController.GetAllArticles(portalId)) { var pageUrl = new SitemapUrl { Url = ArticleController.GetArticleLink(ai.TabID, ai.ArticleId), Priority = (float)0.5, LastModified = ai.LastModifiedOnDate, ChangeFrequency = SitemapChangeFrequency.Daily }; listOfUrls.Add(pageUrl); } return(listOfUrls); }
public string GetArticleLink(string articleId) { return(ArticleController.GetArticleLink(TabId, Convert.ToInt32(articleId))); }
protected void Page_Load(object sender, EventArgs e) { var ps = new PortalSettings(PortalId); Response.ContentType = "text/xml"; Response.ContentEncoding = Encoding.UTF8; var sw = new StringWriter(CultureInfo.InvariantCulture); var wr = new XmlTextWriter(sw); wr.WriteStartElement("rss"); wr.WriteAttributeString("version", "2.0"); wr.WriteAttributeString("xmlns:wfw", "http://wellformedweb.org/CommentAPI/"); wr.WriteAttributeString("xmlns:slash", "http://purl.org/rss/1.0/modules/slash/"); wr.WriteAttributeString("xmlns:dc", "http://purl.org/dc/elements/1.1/"); wr.WriteAttributeString("xmlns:trackback", "http://madskills.com/public/xml/rss/module/trackback/"); wr.WriteStartElement("channel"); wr.WriteElementString("title", ps.PortalName); //Get aliases var portalAliases = PortalAliasController.Instance.GetPortalAliasesByPortalId(PortalId);//.GetPortalAliasesByPortalId(portalId); var pa = (portalAliases != null && portalAliases.Count <PortalAliasInfo>() > 0 ? portalAliases.ElementAt <PortalAliasInfo>(0) : null); if (pa.HTTPAlias.IndexOf("//", StringComparison.OrdinalIgnoreCase) == -1) { wr.WriteElementString("link", "//" + pa.HTTPAlias); } else { wr.WriteElementString("link", pa.HTTPAlias); } wr.WriteElementString("description", "RSS Feed for " + ps.PortalName); wr.WriteElementString("ttl", "120"); var dt = new DataTable { Locale = CultureInfo.InvariantCulture }; //dt = ItemId == -1 ? DataProvider.Instance().GetMostRecent(ItemTypeId, NumberOfItems, PortalId) : DataProvider.Instance().GetMostRecentByCategoryId(ItemId, ItemTypeId, NumberOfItems, PortalId); var al = ArticleController.GetArticles(ModuleId); if (al != null) { foreach (var a in al) { wr.WriteStartElement("item"); DateTime startDate = DateTime.MinValue; wr.WriteElementString("title", a.Title); wr.WriteElementString("link", ArticleController.GetArticleLink(a.TabID, a.ArticleId)); wr.WriteElementString("description", Server.HtmlDecode(a.Description)); wr.WriteElementString("thumbnail", a.ThumbImg); wr.WriteElementString("dc:creator", a.CreatedByUser); wr.WriteElementString("pubDate", a.CreatedOnDate.ToUniversalTime().ToString("r", CultureInfo.InvariantCulture)); wr.WriteStartElement("guid"); wr.WriteAttributeString("isPermaLink", "true"); wr.WriteString(ArticleController.GetArticleLink(a.TabID, a.ArticleId)); wr.WriteEndElement(); wr.WriteEndElement(); } } wr.WriteEndElement(); wr.WriteEndElement(); Response.Write(sw.ToString()); }