More in this section

Forums / Developing with Sitefinity / Activating socialBookmarkTemplate.xml in News section

Activating socialBookmarkTemplate.xml in News section

6 posts, 0 answered
  1. Vishal Sharma
    Vishal Sharma avatar
    10 posts
    Registered:
    20 May 2010
    07 Jun 2010
    Link to this post
    Hi..
    I had gone through a tutorial for the working of Social Bookmarking features in Sitefinity. Here is the tutorial which i followed..
    http://www.sitefinity.com/devnet/kb/sitefinity-3-x/social-bookmarks-in-sitefinity.aspx

    I just want to ask how can i activate socialBookmarkTemplate.xml in news section in my website.
    Also how can i open this file , I am not able to open this xml, can't see the code of this file, which has been illustrated in the example.
    I am not able to activate or upload this file in my news section.

    Thanks
    Vishal


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Jun 2010
    Link to this post
    Hello Vishal Sharma,

    The template should be located under Sitefinity\ControlTemplates\News\socialBookmarkTemplate.xml.
    The folder that contains all images for the social bookmarks is Sitefinity\ControlTemplates\News\SocialBookmark

    To activate bookmarks

    • Drop NewsView control on  a page
    • Open the control from editing
    • Go to Advanced Tab
    • Scroll down and you will find a properties section called - Social Bookmarks
    From there you could set BookmarkEnabled and the path to the socialBookmarkTemplate.xml.

    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. Vishal Sharma
    Vishal Sharma avatar
    10 posts
    Registered:
    20 May 2010
    07 Jun 2010
    Link to this post
    I had added these social bookmarking buttons by using Add to this buttons. SO in this case, should i need to disable ADD to this button first ,or can i use both these features, in siteinfinity.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Jun 2010
    Link to this post
    Hi Vishal Sharma,

    Could you elaborate some more about what you have done and what you want to disable/enable?

    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.
  5. Vishal Sharma
    Vishal Sharma avatar
    10 posts
    Registered:
    20 May 2010
    07 Jun 2010
    Link to this post
    Hi...

    I had added a button which is provided by "ADD to this" website, which lets us to share our links on different social networking websites.
    Like you can see the button share button here..
    http://personalfn.com/detail.asp?date=5/08/2010&story=2

    Same button I had enabled in my Sitefinity template.
    BUt now i want to disable this button and want to enable the button which sitfinity provides, bcz of good graphics.
    But Somehow, I am not able to enable these social bookmarks, provided by sitefinity.
    So my question is that Should i need to remove this button first, or can i enable it without removing this button?
    Another thing i want to ask is that..
    I have different -different news for different - different  sections in my website, and top news are excerpt in main category page. i want to show these button individually on the each news articles.
    So, how can i enable these social bookmarks in each news article individually?

    thanks
    Vishal
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Jun 2010
    Link to this post
    Hi Vishal Sharma,


    Your image name should be the same as the title of the Bookmark otherwise the image will not appear. By design there is no option to show certain bookmarks on certain articles. The NewsView control loads all bookmarks declared in the xml file. There is a method RenderBookmark which is protected and cannot be overridden. You can override SetItemMetadata method and there implement a custom method where you show only specific bookmarks

    sample

    protected void RenderBookmarkCustom(Control itemContainer, IContent content)
            {
                // hide the default control and use a custom one with ID Bookmarks1
                Repeater bookmarks = FindContentViewControl("Bookmarks1", itemContainer) as Repeater;
                if (bookmarks != null)
                {
                    Bookmark.PostUrl = HttpUtility.UrlEncode(Context.Request.Url.ToString());
                    string rawPostName = String.Empty;
                    if (Manager.MetaKeys.ContainsKey("Title"))
                    {
                        rawPostName = content.GetMetaData("Title") as string;                   
                    }
                    else if (Manager.GetType() == typeof(ContentManager) && Manager.MetaKeys.ContainsKey("Name"))
                    {
                        rawPostName = content.GetMetaData("Name") as string;
                    }               
                     
                    if (String.IsNullOrEmpty(rawPostName))
                    {
                        string text = content.Content as string;
                        if (text == null)
                        {
                            text = String.Empty;
                        }
     
                        rawPostName = SummaryParser.GetSummary(text, new SummarySettings(SummarySettings.SummaryMode.Words, 10, true));
                    }
     
                    if (!String.IsNullOrEmpty(rawPostName))
                    {
                        Bookmark.PostTitle = HttpUtility.UrlEncode(rawPostName);
                    }
     
                    bookmarks.ItemDataBound += new RepeaterItemEventHandler(bookmarks_ItemDataBound);
                    bookmarks.DataSource = Bookmark.Bookmarks;
                    bookmarks.DataBind();
                }
            }
     
            void bookmarks_ItemDataBound(object sender, RepeaterItemEventArgs e)
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    SocialBookmark.Bookmark bookmark = e.Item.DataItem as SocialBookmark.Bookmark;
     
                  // show/hide certain bookmarks
     
                }
            }


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