-2

Recently I got one requirement that in quick launch we need to hide recent tag.

It should not come in any page and list, under sub site level or site collection level.

If anybody knows, please tell me

Gianmarco
  • 2,536
  • 25
  • 57

2 Answers2

0

Create a webpart and add it in master page.

To add a webpart in master page look Here

Use this javascript on your webpart:-

<script>
$(document).ready(function(){
 $(".ms-core-listMenu-item").each(function(){
  if($(this).text().indexOf("Recent")!=-1){
    $(this).parent("li").hide();
  }
});
});
</script>

Not tested but it should work.

Note: add javascript reference

Community
  • 1
  • 1
Sharique Ansari
  • 1,458
  • 1
  • 12
  • 22
0

The solution I used was to create a SharePoint group (I called mine "RemoveRecent") and have no users assigned to that group. This effectively hides the menu item from everyone.

I then used this PowerShell script to add the "RemoveRecent" group into the "Audience Targeting" section of the "Recent" Quick Launch Navigation Link.

$Site = Get-SPSite "https://SITECOLLECTION/"

foreach ($Web in $Site.AllWebs)
    {
    $PublishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
    $QuickLaunchNav = $PublishingWeb.Navigation.CurrentNavigationNodes
    $QuickLaunchHeading = $QuickLaunchNav | where {$_.Title -eq "Recent"} 

    if ($QuickLaunchHeading)
        {
        Write-Host $Web.Title "- " -ForegroundColor Green -BackgroundColor Black -NoNewline
        $QuickLaunchHeading.Properties["Audience"] = "RemoveRecent"
        $QuickLaunchHeading.Update()
        Write-Host $QuickLaunchHeading.Properties["Audience"] -ForegroundColor Red -BackgroundColor Black 
        }
    }
OutOfThisPlanet
  • 336
  • 3
  • 17