Blog Tags Customization

Posted by Community Admin on 04-Aug-2018 12:16

Blog Tags Customization

All Replies

Posted by Community Admin on 06-Jul-2011 00:00

Hello Admin,

            I have the following requirement :
            - i have 4 Tags in post SEM, SEO, SMO, Google Analytics 
            - I want to Include 
a tag cloud ( TagName with No of Count ) on Blogs page. ( Blogs Page displays all the list of Post )
            - My BlogPost page is customized (My own User Control ) coz of tht Sitefinities Tags Widget dosent filter the post.It displays 
              proper TagName with Count
            - Please tel me how Should i Customize Tags Widget functionality ? Which methods are used to Display TagName with
              Count ?

Please Help me ...
Thanks & Regards
Anu.

Posted by Community Admin on 06-Jul-2011 00:00

Hi Anu,

You have to use TaxonomyManager and its methods to get the taxons and list them in your cloud. Then you have to use GetItemsByTaxon method of ContentDataProvider to get the count of content items associated with a given taxon.

Kind regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 06-Jul-2011 00:00

Hello Ivan,

Thanks for the Reply. Can u give some sample code ?

Posted by Community Admin on 09-Jan-2012 00:00

Hello Anu,

Did you find any sample code, I am also trying to implement the same functionality?

Thank you.

Posted by Community Admin on 10-Jan-2012 00:00

Hello Ivan,

Do you have any sample code to do so?

Posted by Community Admin on 09-Feb-2012 00:00

Hi,

i created a custom widget to show a cloud of tags associated with posts of my blog.
The following (simplified) code snippet of my widget .ascx control might not be the best solution, but it works:

<%@ Control Language="C#" %>
<%@ Import Namespace="Telerik.Sitefinity" %>
<%@ Import Namespace="Telerik.Sitefinity.Model" %>
<%@ Import Namespace="Telerik.Sitefinity.Blogs.Model" %>
<%@ Import Namespace="Telerik.Sitefinity.Modules.Blogs" %>
<%@ Import Namespace="Telerik.Sitefinity.Taxonomies" %>
<%@ Import Namespace="Telerik.Sitefinity.Taxonomies.Model" %>
<%@ Import Namespace="Telerik.Sitefinity.Modules.GenericContent" %>
 
<script type="text/C#" runat="server">
public string BlogID get; set;
     
protected void Page_Load(object sender, EventArgs e)
            Guid id;
            if (BlogID != "" && Guid.TryParse(BlogID, out id))
                Telerik.Sitefinity.Blogs.Model.Blog blog = App.WorkWith().Blogs().Where(b => b.Id == id).Get().SingleOrDefault();
 
                if (blog != null)
 
                    TaxonomyManager taxManager = TaxonomyManager.GetManager();
                    var tags = taxManager.GetTaxonomies<FlatTaxonomy>().Where(t => t.Name == "MyTagClassification").SingleOrDefault();
 
                    if (tags != null)                       
                        foreach (var tag in tags.Taxa)
                            RadTagCloudItem item = new RadTagCloudItem();
                            item.Text = tag.Name;
 
                            var posts = App.WorkWith().Blog(blog.Id).BlogPosts().Where(ci => ci.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && ci.GetValue<IList<Guid>>("MyTagClassification").Contains(tag.Id)).Get().ToList();
 
                            item.Weight = posts.Count;
                            TagCloud1.Items.Add(item);
                        
                    
                
            
        
</script>
                 
 <telerik:RadTagCloud ID="TagCloud1" runat="server"></telerik:RadTagCloud


HTH
Matthias

Posted by Community Admin on 10-Feb-2012 00:00

Hello Matthias,

Thank you for your reply and also for providing the code. I was trying to implement the code you have provided below. But, I was thinking how you were associating this widget with each blog post item. Could you please let me know.Sorry, for the question if it is really simple.

Thank you once again.

This thread is closed