Managing the user experience in SharePoint often requires more than just setting up document libraries; it involves curating exactly what your users can see. One of the most common requests from administrators is how to hide the Site Contents link (formerly 'View All Site Content') from visitors or specific security groups.

Whether you are building a clean extranet portal or a high-traffic internal landing page, the 'Site Contents' page can be a distraction. It exposes the structure of your site, showing every list, library, and app, which might not be appropriate for casual visitors. In this guide, we will explore several methods to achieve this, ranging from simple permission adjustments to UI-level code customizations.

The most robust way to hide the Site Contents link is through SharePoint's built-in permission system. This method is preferred because it doesn't just hide the link; it actually restricts access to the underlying application pages. There are two primary ways to handle this through permissions.

Using the 'Restricted Read' Permission Level

SharePoint includes a default permission level called Restricted Read. Unlike the standard 'Read' level, Restricted Read is designed specifically for users who need to see content but should not have access to the site's structural metadata.

When you assign a user or group to the 'Restricted Read' level: 1. They can still view pages and documents. 2. The Site Contents link is automatically removed from the Quick Launch (left navigation). 3. The Site Contents option is removed from the Gear icon (Site Actions menu).

Customizing the 'Read' Permission Level

If you prefer to keep the standard 'Read' level but want to strip out the ability to see site content, you can modify the permission level itself.

  1. Navigate to Site Settings > Site Permissions.
  2. In the ribbon, click on Permission Levels.
  3. Click on the Read permission level to edit it.
  4. Scroll down to the Site Permissions section and uncheck the box for View Application Pages.
  5. Click Save.

Note: The 'View Application Pages' permission is what allows users to see /_layouts/15/viewlsts.aspx (the Site Contents page). Removing this will hide the links globally for anyone assigned to that specific permission level.

Method 2: Hiding the UI with CSS and jQuery

Sometimes you want to hide the link for visual cleanliness without necessarily breaking the user's ability to access application pages if they have a direct link. This is often referred to as "security through obscurity."

If you have access to your site's Master Page or a custom CSS file, you can hide the 'Site Contents' link in the Quick Launch with a simple CSS rule. In SharePoint 2013 and Classic versions, the link usually has a specific ID or can be targeted via its href.

/* Hide Site Contents in the Quick Launch */
#sideNavBox a[href$='/_layouts/15/viewlsts.aspx'] {
    display: none !important;
}

/* Hide Site Contents from the Gear Icon (Site Actions) */
#mp1_0_0_Anchor, /* This ID may vary by version */
#zz15_MenuItem_ViewAllSiteContents {
    display: none !important;
}

Conditional Hiding with jQuery

If you only want to hide the link for a specific group (e.g., 'Visitors') while keeping it visible for 'Owners', you can use jQuery to check group membership. This code should ideally be placed in your Master Page just before the closing </body> tag.

$(document).ready(function() {
    // Check if the current user is in the 'Visitors' group
    // This is a simplified logic example
    var userInGroup = false;

    // You can use SPServices or the REST API to check group membership
    // If user is a visitor, hide the elements
    if (userInGroup) {
        $("#sideNavBox a:contains('Site Contents')").hide();
        $("#zz15_MenuItem_ViewAllSiteContents").hide();
    }
});

Method 3: Using Target Audiences

In SharePoint Classic, navigation links in the Quick Launch and Top Link Bar support Target Audiences.

  1. Go to Site Settings > Navigation.
  2. Find the 'Site Contents' link in the Structural Navigation section.
  3. Edit the link and find the Audiences field.
  4. Specify the groups that should see the link (e.g., Members and Owners).
  5. Visitors (who are not in those groups) will no longer see the link in the navigation menu.

Warning: This only hides the link in the navigation menu. It does not hide it from the Gear icon, nor does it prevent direct URL access.

Security vs. Obscurity: A Critical Distinction

It is vital to understand the difference between hiding a link and restricting access.

  • Hiding (CSS/jQuery/Audiences): The user cannot see the link, but if they type your-site-url/_layouts/15/viewlsts.aspx directly into their browser, the page will still load for them.
  • Restricting (Permission Levels): The user cannot see the link, and if they try to access the URL directly, they will receive an "Access Denied" message.

For true security, always use Method 1. If you only care about the aesthetic of the sidebar, Method 2 or 3 is sufficient.

Best Practices and Common Pitfalls

  • Don't Edit Default Permissions Directly: Instead of modifying the default 'Read' level, it is better practice to click 'Copy Permission Level' and create a new one called 'Read - No Site Contents'. This prevents accidental global changes that might be hard to revert.
  • Master Page Risks: If you use jQuery or CSS in the Master Page, ensure you have a backup. A syntax error in the Master Page can break the entire site for all users.
  • Search Impact: Restricting 'View Application Pages' generally does not stop items from appearing in search results, provided the user has 'View Items' permissions on the underlying lists.
  • Version Context: These methods primarily apply to SharePoint 2013, 2016, 2019, and SharePoint Online in Classic Mode. Modern SharePoint sites handle navigation differently through the 'Edit' menu on the sidebar, where you can simply remove the link without code.

Frequently Asked Questions

Can I hide Site Contents only for a specific security group?

Yes. The best way is to create a custom Permission Level (as described in Method 1) and assign that specific security group to that level while leaving other groups (like Members) on the standard 'Read' or 'Edit' levels.

Does hiding Site Contents hide the lists and libraries too?

No. Hiding the 'Site Contents' page only hides the index of the site. Users can still access specific lists or libraries if they have the direct URL or if those items are linked elsewhere on your site.

Why can visitors still see the 'Gear' icon?

In SharePoint 2013, the gear icon (Site Actions) is visible to anyone with the 'Open' permission. However, the options inside the menu are trimmed based on permissions. By removing 'View Application Pages', the 'Site Contents' entry inside that menu will disappear.

Wrapping Up

Controlling the visibility of the Site Contents page is a key step in professionalizing your SharePoint environment. For most administrators, the Restricted Read permission level provides the perfect balance of security and usability. If you require a more surgical approach, combining custom permission levels with targeted CSS will ensure your visitors see only what they need to see, keeping your site interface clean and secure.