none
How i can change the Name & href of the "What's hot" link inside my Discussion board Subject view RRS feed

  • Question

  • I am working on a sharepoint server 2013, and i have added a Discussion Board list. where inside the default Subject view there is a link named "What's Hot" as follow:-

    enter image description here

    so can i change the link text to be "Management" instead of "What's Hot", and change the URL's href to be referencing the built-in management.aspx view ??

    now i usually use self-executing anonymous functions to achieve this kind of customization. For example to change the text for the create new discussion link from "new discussion" to "updated name", i use the following function loaded inside a script editor:-

    <script type="text/javascript">
    //self-executing anonymous function
    (function () {
        // String overrides
        function DiscussionListViewStringOverride() {
            Strings.STS.L_SPDiscHeroLinkAltText = "updated text";
            Strings.STS.L_SPDiscHeroLinkFormat = "Updated name";
        }
    
        DiscussionListViewStringOverride();
        ExecuteOrDelayUntilScriptLoaded(DiscussionListViewStringOverride, "strings.js");
    })();
    </script>

    so can i follow similar approaches to change the "What's Hot" link name and href?

    Tuesday, February 28, 2017 12:20 AM

All replies

  • Hi John,

    We can use Jquery code below to change the What's hot title and link:

    <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        setInterval(changenameandlink, 1000); 
        function changenameandlink()
        {
            $(".ms-pivotControl-container").find("a").eq(1).text("Management");
            $(".ms-pivotControl-container").find("a").eq(1).attr('onclick','').unbind('click');
            $(".ms-pivotControl-container").find("a").eq(1).attr('href',' http://sp/sites/teams/_layouts/15/start.aspx#/Lists/discuss2/Management.aspx');
    
           
        }
        
    </script>
    

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, February 28, 2017 8:44 AM
  • Hi John,

    We can use Jquery code below to change the What's hot title and link:

    <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        setInterval(changenameandlink, 1000); 
        function changenameandlink()
        {
            $(".ms-pivotControl-container").find("a").eq(1).text("Management");
            $(".ms-pivotControl-container").find("a").eq(1).attr('onclick','').unbind('click');
            $(".ms-pivotControl-container").find("a").eq(1).attr('href',' http://sp/sites/teams/_layouts/15/start.aspx#/Lists/discuss2/Management.aspx');
    
           
        }
        
    </script>

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com


    thanks for your reply. now i always prevent to hard-code the css classes names as you did in
    .ms-pivotControl-container
    , since these css class names might changed in the future if we install some sharepoint updates.. is this correct? i was searching for a more robust appraoch to do so ,, without having to rely on referencing css class names which might get changed in the future... is my concerns valid ? and can i use a more standard way to achieve this ?
    Tuesday, February 28, 2017 12:49 PM
  • Hi John,

    But there is not Client API to modify the title and the link, Jquery is still a good option to achieve it.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, March 6, 2017 2:07 AM