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

Forums / Developing with Sitefinity / Tags in the NewsList

Tags in the NewsList

17 posts, 0 answered
  1. Tom
    Tom avatar
    9 posts
    Registered:
    17 Jul 2006
    09 Apr 2008
    Link to this post
    I have been through the forums for awhile now and I think the answer to my question is no, but I just want to make sure.

    Can you filter the newslist by a particular tag out of the box or do you need to write a custom control?

    I am not sure why you would tag news items if you can not filter by them.

    I would think you should be able to pick them like you can pick a category or at least use them in a filterexpression.  If you can use them in a filter expression, even by using the GUID, what is the syntax?

    Thanks for any help.
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    11 Apr 2008
    Link to this post
    Hi Tom,

    Sitefinity provides Tags List public control for filtering by tags. It can be found in Tags & Categories section of Add Controls toolbox. After inserting the Tags List control on a page you need to edit its properties as described below:

    1. Expand the Data section of the Property Window and type News for the ProviderName property.
    2. Expand the Behavior section and for the TaggedContentUrl field, select the page to which the user will be redirected after opening a tag link. Usually, this is the page where the News Lists control has been inserted.

    You could also find useful information in the User Manual -> Tags and Categories  ->  Tags.
     
    Do let us know if you need any further assistance.

    Regards,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Tom
    Tom avatar
    9 posts
    Registered:
    17 Jul 2006
    11 Apr 2008
    Link to this post
    Pepi,
    This is close, but not quite what I was looking for.

    What I am looking for is what I do get after clicking on a Tag from the Tag List control and am redirected to a page with the News List control on it.  I get a list of news that is filtered by a particular tag.

    I want to be able to have a page that contains a News List that is already filtered by a particular tag with out having to click on a tag in a Tag List control first.

    What we are trying to do is have news that is broken down into certain catagories and then is also tagged with a few tags.  On certain pages we will show all of the news from a certain catagory.  On a different page we want to show the news from the catagory but only if it contains a certain tag.

    Example:
    On the home page we might show all news that is in the catagory "press releases" in a right hand column.
    On another page we might show news that is in the catagory "press releases", but only related to the tag "community1".

    So, the news list that is generated after clicking on a tag is exactly what I want.  I just do not want to have to click on a tag first.

    Does this make sense?

    Thanks for the help - I love the product.

    -Tom
  4. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    14 Apr 2008
    Link to this post
    Hello Tom,

    Unfortunately, the current NewsList control does not provide such functionality. But you could create your own NewsList control that inherits from the ContentView base class. Here is a reference to a KB article describing how to override ContentView class: The Content view control

    Hope this is helpful for you.

    All the best,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Tom
    Tom avatar
    9 posts
    Registered:
    17 Jul 2006
    14 Apr 2008
    Link to this post
    I was afraid of that.

    You do have the functionality built in to the NewsList control, it just reads a URL string.  It would be nice in a future release to add this functionality as a filiter option to the News List control.

    Thanks,

    -Tom
  6. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    14 Apr 2008
    Link to this post
    Hi Tom,

    Actually, we have plans to implement a new NewsList control for the upcoming release (Service Pack 2, scheduled for May) that will provide a lot of improvements. So, we will definitely discuss your suggestion for filtering news items by tags.

    All the best,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Tom
    Tom avatar
    9 posts
    Registered:
    17 Jul 2006
    14 Apr 2008
    Link to this post
    Sounds good - we will look for SP2 when it comes out.

    Thanks for thinking about adding this feature.

    -Tom
  8. Paul Dain
    Paul Dain avatar
    7 posts
    Registered:
    15 Mar 2006
    25 Apr 2008
    Link to this post
    While the tagging is useful, it would be awesome to have this content in the search index. Is this capability planned for SP2 as well?
  9. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    28 Apr 2008
    Link to this post
    Hi Paul Dain,

    Implementation of various search providers (or better to say search indexes for various modules) is on our to do list. Unfortunately, the SP2 release is mainly focused on completely stabilizing the system and working out the pressing issues, therefore we will not have search provider specific for NewsModule in the next release.

    You could work around this by having the NewsControls on a subpage and then implementing a PageIndex only for those pages.

    Thank you for your valuable feedback and ideas.

    Best wishes,
    Ivan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  10. nogatek
    nogatek avatar
    35 posts
    Registered:
    23 Apr 2008
    09 Aug 2008
    Link to this post
    Hi there,

    I am trying to implement the News View control that reads in the category and tag filter specifiers from query string values.

    I also want to use the category and tag names - not IDs.

    example: News.aspx?NewsTagName=My Tag

    I've tried editing the Advanced 'Behavior' and 'Querystring' settings in the News View control, but the urls/query strings in the master and detail views are still rendering with the ID values? (i.e. not the actual name, as in the example above).

    Is this sort of functionality possible? It would seem it is.

    Any help would be greatly appreciated!

    Thanks, Mark
  11. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    10 Aug 2008
    Link to this post
    Hello Mark,

    unfortunately, at the moment, passing tag name in query string is not possible. We are working on the new advanced Generic Content API (tags are part of Generic Content) for Sitefinity 4.0 (it'll be 100% backward compatible). Tags and Categories will be reworked and improved in 4.0, and most probably we will introduce a new option (without querystrings) when filtering by tag or category, so that it becomes part of the url - which will help the SEO efforts and I am assuming this is what you are after as well.

    I am sorry that I was not able to help you more at this moment. Let us know if there is anything else we can do for you.

    Regards,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  12. nogatek
    nogatek avatar
    35 posts
    Registered:
    23 Apr 2008
    11 Aug 2008
    Link to this post
    Thanks Ivan.

    Okay, no problem.

    How about this: I have implemented some code that appends the category and tag IDs to the query string. So what about overriding the CreatFilter() method of the underlying Content View class? Do you have any code examples for this?

    The KB article 'The Content View control and its offspring, Blog Posts - ID#942' alludes to this, but some sample code would be nice.

    Thanks, Mark
  13. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    12 Aug 2008
    Link to this post
    Hi Mark,

    We have an article on overriding the ContentView control and you can find it here:
    http://www.sitefinity.com/help/developer-manual/extending-built-in-controls-content-view-control.html

    There are two things I want to mention here:
    - You cannot create a filter for tags. The only way to filter by tag right now is to set the TagID property of the ContentView control. (so once you get the ID from the query string, set the TagID property to the value of the query string)
    - Categories should be added to the filter in the CreateFilter method, but only Category names - not IDs. You can use ContentManager to get the name of the category based on the ID - ContentManager.GetCategory(Guid id) method.

    I know that this sounds a bit complicated and inconsistent at the moment. We realize this and in Sitefinity 3.5 which is due at the end of September we will add a new property to the ContentView based controls called FilterExpression. All filtering will be done through this property whether through API or simply by typing it in (the syntax is very simple to the SQL after the WHERE statement - e.g. Author = "Ivan" AND Category IN ("Cat 1", "Cat 2").

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    All the best,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  14. Randel
    Randel avatar
    50 posts
    Registered:
    30 Aug 2012
    22 Sep 2008
    Link to this post
    Ivan,

    Can you tell me if the release of Sitefinity 3.5 is still on schedule for the end of September (09/2008) and if it the advancements for Categories and Tags will make it into it?
  15. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    23 Sep 2008
    Link to this post
    Hi Randel,

    yes we are on schedule. We expect to release over the period of next two weeks. Also, the fixes regarding categories and tags have been implemented and will be released.

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    Best wishes,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  16. Richard Baugh
    Richard Baugh avatar
    201 posts
    Registered:
    22 Aug 2012
    07 Apr 2009
    Link to this post
    I know this is an old post but I ran into an issue trying to use the Tag.ID as a filter in the FilterExpression for 3.5 SP1. When you try and filter using the Tag.ID = {guid} expression, it doesn't seem to filter. I got it to work using the Tag.Name expression, but it will throw an error if the tag name gets changed.

    One workaround I found was to use the obsolete properties.
    1) On the "Basic" tab, select "Images from selected Libraries" and then select the library from which you want to use.
    2) Click on the "Advanced" tab. Navigate to the "Filters" category. In the "FilterExpression" property, you should see the value "ParentID IN (guid)" where "guid" is the ID of the gallery. Copy the gallery ID, delete the "FilterExpression" value, and then go to the "Behavior" category. Paste the value in the box for the "ParentIDs" property. 
    3) In the "Obsolete members" category. In the TagID property, set the value of the Tag that you wish to filter, which can be found from a tag list added to a page.

    Following these steps results in the library being filtered by the Tag.

    Another option would be to create a new class that inherits the Image Gallery control and create a property that will accept the Tag ID and then add a ContentFilterStatment using the Tag name. Below is an example:

    1 using System; 
    2 using System.ComponentModel; 
    3 using System.Text.RegularExpressions; 
    4 using Telerik.Cms.Engine; 
    5 using Telerik.Cms.Engine.ContentViewFiltering; 
    6 using Telerik.Cms.Engine.WebControls; 
    7 using Telerik.Libraries.WebControls; 
    8  
    9 public class ExtendedImageGallery : ImageGallery 
    10
    11     #region Private Variables 
    12     private Guid _filterTagID = Guid.Empty; 
    13     #endregion 
    14     
    15     #region Public Properties 
    16     /// <summary> 
    17     /// Gets or sets the Tag GUID. This property will force the control to display a list of items tagged by the selected tag. 
    18     /// </summary> 
    19     [Category("Filters")] 
    20     public Guid FilterTagID 
    21     { 
    22         get 
    23         { 
    24             return this._filterTagID; 
    25         } 
    26         set 
    27         { 
    28             this._filterTagID = value; 
    29         } 
    30     } 
    31     #endregion 
    32     
    33     #region Overriden Methods 
    34     protected override void CreateChildControls() 
    35     { 
    36         ContentFilterBuilder filterBuilder = new ContentFilterBuilder(this); 
    37          
    38         if (FilterTagID != Guid.Empty) 
    39         { 
    40             ITag tag = Manager.GetTag(FilterTagID); 
    41             filterBuilder.AddFilter(new ContentFilterStatement("Tag.Name", tag.TagName, 
    42                                                                ContentFilter.Condition.Equal, 
    43                                                                ContentFilter.JoinType.And));             
    44         } 
    45         base.CreateChildControls(); 
    46     } 
    47     #endregion 
    48

    Then just add the control to the toolboxControls in the web.config.

    This might have been fixed or addressed in 3.6 but is a workaround for 3.5 SP1. It seems that there is a method called GetTagsFilter with a return type of Guid[] in the ContentFilterBuilder class, but there is no GetContent method that accepts the Guid[] type for the tag filter. GetContent only accepts the tag name filter which is of type string.
  17. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    08 Apr 2009
    Link to this post
    Hi Richard Baugh,

    You are right, and this is still not fixed.
    Thank you for providing the workaround though. We have updated your Telerik account.

    Greetings,
    Georgi
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Register for webinar
17 posts, 0 answered