This project is read-only.

Related posts and Previous/Next

Topics: ASP.NET 2.0, Themes
Dec 28, 2008 at 12:46 AM

My personal theme is almost done.

I still have 2 problems

1. When I clic an a post, in the bottom, I have "Related posts", the presentation is not correct 100%, how can I change that I'd like to have the the title and the first line under. At this time, I have title, first line, title, first line .... on a single line. Disable possible ?

2. When I click on a post, on the top I have previous/next post, I'd like change the look where can I do that ? Disable possible ?


Dec 28, 2008 at 1:44 AM
1. For Related Posts, you can control the layout by modifying RelatedPosts.cs located under App_Code\Controls.

2. For Previous/Next Post links, you can control the layout by modifying post.aspx in your blog's root folder.
Dec 28, 2008 at 3:42 AM
I was just working on modifying the layout for the related posts. I noticed that if you set the description to true, it doesn't look so good. You could do it with css, but I'd rather have it looking good from the get go. Here's my modified version

/// <summary>
        /// Creates the list of related posts in HTML.
        /// </summary>
        /// <param name="relatedPosts">The related posts.</param>
        private void CreateList(List<IPublishable> relatedPosts)
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            string link = "<li><a href=\"{0}\">{1}</a>";
            string desc = "<p>{0}</p>";
            sb.Append("<div id=\"relatedPosts\">");
            int count = 0;
            foreach (IPublishable post in relatedPosts)
                if (post != this.Item)
                    sb.Append(string.Format(link, post.RelativeLink, HttpUtility.HtmlEncode(post.Title)));
                    if (ShowDescription)
                        string description = post.Description;
                        if (description != null && description.Length > DescriptionMaxLength)
                            description = description.Substring(0, DescriptionMaxLength) + "...";

                        if (String.IsNullOrEmpty(description))
                            string content = Utils.StripHtml(post.Content);
                            description = content.Length > DescriptionMaxLength ? content.Substring(0, DescriptionMaxLength) + "..." : content;

                        sb.Append(string.Format(desc, description));



                if (count == MaxResults)

            _Cache.Add(Item.Id, sb.ToString());
Dec 28, 2008 at 9:36 AM
Thanks for your answer, it's ok now.