protected List <BlogPost> InitContent() { BlogPageItem blogPage = Sitecore.Context.Item; string blogId = blogPage.BlogId; List <BlogPost> dataSource = TelligentService.ListBlogPosts(blogId, "100"); foreach (var item in dataSource) { BlogsPostPageItem blogPost; if (item.Title.Contains("{")) { string[] s = item.Title.Split('{'); item.Title = s[0]; blogPost = Sitecore.Context.Database.GetItem("{" + s[1]); } else { blogPost = Sitecore.Context.Database.GetItem("/Sitecore/Content/Home/Community and Events/Blogs/" + item.BlogName + "/" + item.Title); } BlogsAuthorPageItem author = Sitecore.Context.Database.GetItem(blogPost.Author.Raw); item.Author = author.Name; item.Body = TelligentService.FormatString100(Sitecore.StringUtil.RemoveTags(blogPost.Body.Raw)); item.AuthorUrl = LinkManager.GetItemUrl(author); } return(dataSource); }
protected void Page_Load(object sender, EventArgs e) { BlogPageItem blogPage = Sitecore.Context.Item; //Try to get the blog ID from querystring string id = blogPage.BlogId; if (id != null) { follBtn.LoadState(id, UnderstoodDotOrg.Common.Constants.TelligentContentType.Blog); } Blog b = TelligentService.ReadBlog(id); litBlogtitle.Text = b.Title; litBlogDescription.Text = b.Description; }