+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / BlogPosts control not showing posts by category

BlogPosts control not showing posts by category

15 posts, 0 answered
  1. ASherrick
    ASherrick avatar
    6 posts
    Registered:
    11 Jul 2012
    30 Aug 2010
    Link to this post
    I'm running v3.7.2 and when I try to view blog posts by category I get no results. My control is set to only show posts from a single blog.  Here's the Filter Expression: Publication_Date <= "#now" AND ParentID IN (38f7bd08-b2a1-479c-a44c-1de7f2c892f8).  I have the CategoryKey set to "BlogCatID" and my CategoryKeyType is set to "ID".  Here is a sample URL that I enter into the browser: /blog.aspx?BlogCatID=1728cf6a-1c7c-4d4e-8da9-eb858f8bdbd8

    Any ideas what I might be doing wrong?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    31 Aug 2010
    Link to this post
    Hi ASherrick,

    I am not able to reproduce this issue with BlogPosts control. You could also give a try checking this on our demo website. The control should filter by category without any additional modifications.  Check whether the post has been published and it has been categorized to the right category( which ID you use in the url).

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. ASherrick
    ASherrick avatar
    6 posts
    Registered:
    11 Jul 2012
    31 Aug 2010
    Link to this post
    Has there been any bug fixes related to this since 3.7.2?  I mirrored the settings on your test site and I'm still getting the same results.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    31 Aug 2010
    Link to this post
    Hi ASherrick,

    If you use the same settings which were posted here the item should appear. I checked this on the online demo and it works file. I attached a sample video.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. ASherrick
    ASherrick avatar
    6 posts
    Registered:
    11 Jul 2012
    15 Sep 2010
    Link to this post
    This does not work on my site.  I even updated to the latest version to no avail.  Can you email me privately so I can give you a login to the site so you can check it out? Thank you!
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    15 Sep 2010
    Link to this post
    Hello ASherrick,

    You can open a support request and send the credentials there so we could see what is going wrong.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    17 Apr 2011
    Link to this post
    Hello ASherrick,

    I have run into the same issue whereby no posts are appearing when selecting a category.

    Did you get this resolved? I'm just curious if we have the same issue.

    Thanks,
    Gary
  8. ASherrick
    ASherrick avatar
    6 posts
    Registered:
    11 Jul 2012
    17 Apr 2011
    Link to this post
    Gary,

    I'm really sorry; I don't remember! I can tell you that the Blog Posts control is a nightmare to use. Its settings, and the settings of any controls that are associated with it (e.g. Category List), have to be perfect or it won't do what you want it to do.
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    18 Apr 2011
    Link to this post
    Hello ,

    Can you confirm that you have set QueryString keys for the BlogPosts and CategoriesTree controls? These settings should be the same in both the controls.

    All the best,
    Ivan Dimitrov
    the Telerik team

  10. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    18 Apr 2011
    Link to this post
    Here is a bit more information:

    I am using these controls from within a user control rather than in the Sitefinity designer directly.

    My initialization of the BlogPosts control is:

    blogPosts1.ProviderName = "Blogs";
    blogPosts1.FilterExpression = String.Format("ParentID IN ({0})", blogID);
    blogPosts1.ItemListTemplateName = "Telerik.Blogs.Resources.ControlTemplates.Frontend.Modes.AllPostsListMaster.ascx";
    blogPosts1.DisplayMode = Telerik.Cms.Engine.WebControls.ContentView.DisplayModes.Auto;
    blogPosts1.CategoryKey = "BlogCatID";

    The attachment demonstrate the URL that is navigated to when a category is selected from a custom control that inherits from the CategoryList control (I know the recommendation is to use the CategoryTree, but I only want to display a single level in a bulleted list).

    As you can see the category key "BlogCatID" is applied for both passing and receiving the category.

    Any thoughts on why no posts are appearing?

    Regards,
    Gary
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    18 Apr 2011
    Link to this post
    Hello Gary,

    Try clearing the filter and setting it to Category = "Name of your category"

    sample

    if (!IsGuid(Context.Request.QueryString[blogPosts1.CategoryKey]))
        {
             // clear the filter and add
             // Category = 'CategoryName' as a filter expression
     
        }
     
     private bool IsGuid(string candidate)
           {
               Regex isGuid = new Regex(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", RegexOptions.Compiled);
               bool isValid = false;
     
               if (candidate != null)
               {
                   if (isGuid.IsMatch(candidate))
                   {
                       isValid = true;
                   }
               }
               return isValid;
           }


    Best wishes,
    Ivan Dimitrov
    the Telerik team

  12. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    18 Apr 2011
    Link to this post
    I tracked this down by reflecting BlogPosts and ContentView into custom classes, but the answer still leaves me with problems:

    A lot of my categories have commas within them, for example "Composition, Grade 1". When the categories filter is built (ContentBasic.AddHierarchicalCategoriesFilter) this string is split into two categories "Composition" and "Grade 1", which results in no match. I created the categories through the API but I also tested by creation through the admin UI, and the behavior is the same, so I believe this is a bug Sitefinity 3.7 SP4. It's particularly annoying because it's the GUID and not the name that is being passed, but internally it always resolves to the name before applying the filter.

    After reviewing the filter logic I have a second concern. My category names are not unique, although they are unique within each parent node. I think I'm going to have a problem here as well, since the match is not being made on the GUID.

    I can workaround the first issue by eliminating commas (not ideal, but practical in my circumstance), but i don't have a workaround for the second one, other than to concatenate the names of the parents to create uniqueness, but this is not practical because the names are then too long to be readable in the blog posting UI.

    Is there a way I can customize category filtering to work with the GUID instead of the name?

    Thanks,
    Gary
  13. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    18 Apr 2011
    Link to this post
    Hello Gary,

    This should help with the comma issue.

    http://www.sitefinity.com/devnet/forums/sitefinity-3-x/bugs-issues/comma-in-category-causes-blog-posts-to-not-show.aspx

    All the best,
    Ivan Dimitrov
    the Telerik team

  14. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    18 Apr 2011
    Link to this post
    Thanks, Ivan. I did also find that posting after I had replied.

    But I don't think it helps with the main issue, which is that I need to filter using the GUID rather than the name because my names are not globally unique within the category tree.

    Do you have any thoughts on how this can be addressed?

    Regards,
    Gary
  15. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    22 Apr 2011
    Link to this post
    Hi Gary,

    If you have two categories with the same names you should find another way to identify them - for instance by parent comparison or another parameter.


    Regards,
    Ivan Dimitrov
    the Telerik team

Register for webinar
15 posts, 0 answered