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

Forums / General Discussions / How I can hide fields in RSS feed?

How I can hide fields in RSS feed?

17 posts, 0 answered
  1. Ruben Herrera
    Ruben Herrera avatar
    38 posts
    Registered:
    10 Jul 2009
    30 Mar 2010
    Link to this post
    Hi,

    How I can hide fields in RSS feed for News for example?
    I want to hide "author", "coments" and only show "Title" and "Sumary" with "date".

    Thanks in advance.
    Rubén
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Mar 2010
    Link to this post
    Hi Ruben Herrera,

    Create a custom class that inherits from Telerik.News.Rss.RssChannelProvider and override
     GetRssItems

    public override IList<RssItem> GetRssItems(System.Collections.Specialized.NameValueCollection query)
          {
              IList<RssItem> items = base.GetRssItems(query);
              foreach (RssItem i in items)
              {
                  i.Author = "";
                  i.Comments = "";
              }
           }



    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. Ruben Herrera
    Ruben Herrera avatar
    38 posts
    Registered:
    10 Jul 2009
    12 Apr 2010
    Link to this post
    Hi, sorry to answer late.

    Do you mean create my own user control?
    There are not possibilities to customize original RSS feed?

    Regards, thanks!
    Rubén
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Apr 2010
    Link to this post
    Hello Ruben Herrera,

    There are several modes which you could switch from the UI. Please take a look at the attached screeenshot.

    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. Ruben Herrera
    Ruben Herrera avatar
    38 posts
    Registered:
    10 Jul 2009
    12 Apr 2010
    Link to this post
    Hi Ivan,

    Yes but you can´t select the fields must be appear, for example IE always show "author" field.
    I want "author" field for histoy record but not for show. Then, I think your first post solution is the way to erase this data from de getRSSItems list and make xml to send, do I?

    Thanks.
    Rubén


  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Apr 2010
    Link to this post
    Hi Ruben Herrera,

    Yest the first suggestion would set empty strings for the author and comments and you should not see these values in the browser.

    Best wishes,
    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. Saumitra
    Saumitra avatar
    127 posts
    Registered:
    10 Mar 2009
    10 Jun 2010
    Link to this post
    Hi,

    As per your solution, after inheriting from Telerik.News.Rss.RssChannelProvider, do I need to register my class anywhere in the web.config ?

    Thanks,
    Saumitra
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Jun 2010
    Link to this post
    Hi Saumitra,

    There is a section in the web.config where you have to add the provider

    <rss defaultProvider="Sitefinity">
       <feeds>
         </feeds
        <channelProviders>
     
                  .......
                         .......


    Best wishes,
    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.
  9. Saumitra
    Saumitra avatar
    127 posts
    Registered:
    10 Mar 2009
    10 Jun 2010
    Link to this post
    Hi Ivan,

    I added my CustomRssProvider to the web.config as below:
    <rss defaultProvider="Sitefinity">
                <feeds>
                </feeds>
                <channelProviders>
                    <clear/>
                    <add name="Page Rss Provider" type="Telerik.Cms.Web.RssChannelProvider, Telerik.Cms" settingsControl="Telerik.Cms.Web.UI.RssSettingsControl, Telerik.Cms" viewSettingsControl="Telerik.Cms.Web.UI.RssViewSettingsControl, Telerik.Cms" description="Provides RSS for CMS pages"/>
            <add name="Custom News Rss Provider" type="CustomRSSProvider, App_Code" description="Provides RSS for News"/>
                </channelProviders>
                <providers>
                    <clear/>
                    <add name="Sitefinity" type="Telerik.Rss.Data.DefaultServiceProvider, Telerik.Rss.Data" connectionStringName="DefaultConnection"/>
                </providers>
            </rss>

    But still I'm able to see the "Comments" field in the RSS xml that is rendered.

    Am I missing something ?

    Thanks,
    Saumitra
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Jun 2010
    Link to this post
    Hi Saumitra,

    You need to implement IRssProviderModule in the module you want to use your custom RssChanelProvider You have to return the provider inside GetRssProviders(). Currently the provider you have created is not used by the default modules.

    For instance if you want to do this for NewsModule, you have to create a class that inherits from NewsModule and implement IRssProviderModule members.


    Best wishes,
    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.
  11. Saumitra
    Saumitra avatar
    127 posts
    Registered:
    10 Mar 2009
    10 Jun 2010
    Link to this post
    Hi,

    This is getting more confusing for me. Could you please provide some code samples to demonstrate this in a more elaborated manner ? I've never implemented a custom rss provide in Sitefinity before.

    Thanks,
    Saumitra
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Jun 2010
    Link to this post
    Hi Saumitra,

    You could take a look at this post which shows how to replace the RssProvider.

    Best wishes,
    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.
  13. Saumitra
    Saumitra avatar
    127 posts
    Registered:
    10 Mar 2009
    10 Jun 2010
    Link to this post
    Hi Ivan,

    I went through the post as suggested by you. But still the same result ! I'm not able to hide the Comments field. Following is the code for the Channel provider that i've implemented:
    using Telerik.News;
    using Telerik.News.Rss;
    using Telerik.News.WebControls.Rss;
    using Telerik.Rss;
    using System.Collections.Generic;
      
    /// <summary>
    /// Summary description for CustomNewsRSSChannelProvider
    /// </summary>
    public class CustomNewsRSSChannelProvider : RssChannelProvider, IRssProviderModule
    {
        public CustomNewsRSSChannelProvider()
        {
            //
            // TODO: Add constructor logic here
            //
        }
      
        public override System.Collections.Generic.IList<RssItem> GetRssItems(System.Collections.Specialized.NameValueCollection query)
        {
            return base.GetRssItems(query);
        }
      
        #region IRssProviderModule Members
      
        public RssProviderInfo[] GetRssProviders()
        {
            return new RssProviderInfo[] { new RssProviderInfo(CustomNewsRSSChannelProvider.ModuleName + " Rss Provider", typeof(Telerik.News.Rss.RssChannelProvider).FullName + 
                ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName, new Dictionary<string, string>(),
                typeof(RssSettingsControl).FullName + ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName,
                typeof(RssViewControl).FullName + ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName)
                };
        }
      
        #endregion
      
        internal const string ModuleName = "CustomNews";
    }

    I've also registered the provider in the web.config as follows:
    <rss defaultProvider="Sitefinity">
                <feeds>
                </feeds>
                <channelProviders>
                    <clear/>
                    <add name="Page Rss Provider" type="Telerik.Cms.Web.RssChannelProvider, Telerik.Cms" settingsControl="Telerik.Cms.Web.UI.RssSettingsControl, Telerik.Cms" viewSettingsControl="Telerik.Cms.Web.UI.RssViewSettingsControl, Telerik.Cms" description="Provides RSS for CMS pages"/>
            <add name="CustomNews Rss Provider" type="CustomNewsRSSChannelProvider, App_Code" settingsControl="Telerik.News.WebControls.Rss.RssSettingsControl, Telerik.News" viewSettingsControl="Telerik.News.WebControls.Rss.RssViewControl, Telerik.News" description="Provides RSS for News"/>
                </channelProviders>
                <providers>
                    <clear/>
                    <add name="Sitefinity" type="Telerik.Rss.Data.DefaultServiceProvider, Telerik.Rss.Data" connectionStringName="DefaultConnection"/>
                </providers>
            </rss>

    What else am I missing ?

    Thanks,
    Saumitra
  14. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Jun 2010
    Link to this post
    Hello Saumitra,

    You have not replaced all reference to Telerik.News.Rss.RssChannelProvider and you are still using the default type

    return new RssProviderInfo[] { new  RssProviderInfo(CustomNewsRSSChannelProvider.ModuleName + " Rss Provider", typeof(Telerik.News.Rss.RssChannelProvider).FullName +
                ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName, new Dictionary<string, string>(),
                typeof(RssSettingsControl).FullName + ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName,
                typeof(RssViewControl).FullName + ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName)
                };


    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.
  15. Saumitra
    Saumitra avatar
    127 posts
    Registered:
    10 Mar 2009
    10 Jun 2010
    Link to this post
    Hi Ivan,

    I've changed the method as below:
    public RssProviderInfo[] GetRssProviders()
       {
           return new RssProviderInfo[] { new RssProviderInfo(CustomNewsRSSChannelProvider.ModuleName + " Rss Provider", typeof(CustomNewsRSSChannelProvider).FullName + 
               ", " + typeof(CustomNewsRSSChannelProvider).Assembly.FullName, new Dictionary<string, string>(),
               typeof(RssSettingsControl).FullName + ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName,
               typeof(RssViewControl).FullName + ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName)
               };
       }

    Am I on a right track ? If yes, the result is stil the same.

    Thanks,
    Saumitra
  16. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Jun 2010
    Link to this post
    Hi Saumitra,

    Please check this post which explains what you have to do.

    Kind 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.
  17. Saumitra
    Saumitra avatar
    127 posts
    Registered:
    10 Mar 2009
    10 Jun 2010
    Link to this post
    Hi Ivan,

    Yes, the post that you suggested helped me solve my problem. Thanks a lot for the help.

    Regards,
    Saumitra
Register for webinar
17 posts, 0 answered