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

Forums / Developing with Sitefinity / Blog Posts Control & Tag Links

Blog Posts Control & Tag Links

7 posts, 0 answered
  1. Mike Berlin
    Mike Berlin avatar
    16 posts
    Registered:
    19 Feb 2010
    26 Apr 2010
    Link to this post
    Hello,

    I'm using the blog posts control on the home page of my site to display the latest blog that has been posted.  It's working great except for the link on the tags.  Clicking on the title or the permalink of the blog post takes me to the associated blogs page (/blog/<date>/<title>) and displays the single blog item.  But when I click on one of the tags from the blog post on the home page the link reloads the home page with ?BlogTagID=<guid> attached to the url.

    What I'm expecting is that it would take me to the blogs page with this querystring and list all of the blogs associated with the tag that I clicked on.  Is this possible with the built in blog posts control?  If so, how would I go about doing this.  If it's not possible do you have any suggestions on how to accomplish this?

    Thanks,
    Mike
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    27 Apr 2010
    Link to this post
    Hello Mike Berlin,

    You should set the following properties of the TagList control

    1. ProviderName - Blogs
    2. TaggedContentUrl - url to the page where BlogPosts control has been dropped.
    3.TagKeyType - ID
    4. TagItemKey  - BlogTagID

    The default QueryString keys are set under BlogPosts control >> Advanced >> QueryString Keys. If necessary you could change them, but they should reflect to the TagList control settings.

    Sincerely yours,
    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. Mike Berlin
    Mike Berlin avatar
    16 posts
    Registered:
    19 Feb 2010
    27 Apr 2010
    Link to this post
    Hi Ivan,

    I am not using the TagList control.  I am using the BlogPosts control so I don't see a TaggedContentUrl in the advanced tab.  I have a BlogPosts control on the homepage that renders the latest blog post with tags for that blog post.  When I click the tags on the blog post I want it to go to another page which has a BlogPosts control that should only display the blogs associated with the tag that was clicked from the homepage.  How do I change the links on the tags that the BlogPosts control renders on the homepage?

    Thanks,
    Mike
  4. Mike Berlin
    Mike Berlin avatar
    16 posts
    Registered:
    19 Feb 2010
    27 Apr 2010
    Link to this post
    Any update on this?
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    28 Apr 2010
    Link to this post
    Hello Mike Berlin,

    Here is how the control works.

    1. You have BlogPosts control on a page with tags
    2. You click on a tag link and the same control on the same page is filtered.

    You should extend the built-in control by creating a custom one and implement a public property to set the NavigateUrl of the Tag, so that it could point to the another page where you want to show filtered posts.

    sample code

    public class BlogPostsCustomControl : BlogPosts
    {
        public BlogPostsCustomControl()
        {
        }
        public override string SingleItemTemplatePath
        {
            get
            {
                return "~/Sitefinity/Admin/ControlTemplates/Blogs/Modes/ListPageDetail.ascx";
                
            }
     
        }
     
        public override string ItemListTemplatePath
        {
            get
            {
                return "~/Sitefinity/Admin/ControlTemplates/Blogs/Modes/ListPageMaster.ascx";
            }
        }
     
     
        public virtual string ExternalTagLink
        {
            get
            {
     
                object obj = ViewState["ExternalTagLink"];
                if (obj != null)
                    return (string)obj;
                return string.Empty;
            }
            set
            {
                ViewState["ExternalTagLink"] = value;
            }
        }
     
     
        protected override void TagsRepeater_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                if (!String.IsNullOrEmpty(ExternalTagLink))
                {
     
                    ITag tag = (ITag)e.Item.DataItem;
                    HyperLink tagLink = (HyperLink)e.Item.FindControl("tagLink");
                    if (tagLink != null)
                    {
                        tagLink.Text = tag.TagName;
     
                        tagLink.NavigateUrl = ExternalTagLink + "?BlogTagID=" + tag.ID;
                    }
                }
                else
                {
                    base.TagsRepeater_ItemDataBound(sender, e);
                }
            }
        }
    }


    Response time in forms is 72 hours. Response time in Support is 48 hours.

    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.
  6. Mike Berlin
    Mike Berlin avatar
    16 posts
    Registered:
    19 Feb 2010
    28 Apr 2010
    Link to this post
    Thank you Ivan Dimitrov.  That works great!

    Is it planned for future versions to include a property for the built in control to set this tag link url?  I'd think it would be useful instead of having to create a custom control to change a small piece of the control.

    Thanks again,
    Mike
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    28 Apr 2010
    Link to this post
    Hi Mike Berlin,

    There are not plans for now to extend the control functionality. I will add this as a feature request.

    Regards,
    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.
Register for webinar
7 posts, 0 answered