# How to hide the Space Directory button for Anonymous users

#### Still need help?

The Atlassian Community is here for you.

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Please note that all the workaround stated on this page are beyond Atlassian Support Offerings.

Purpose

The Space Directory provides a list of all the spaces in your Confluence site. If you need to disable the Space Directory for anonymous users, you may do so by using JavaScript as per highlighted below.

## Solution

1. Navigate to Confluence Administration page >> Custom HTML.
2. Click Edit.
3. Add the following to At the end of the HEAD section and click Save:

<script>
AJS.toInit(function(){
if (AJS.params.remoteUser == ''){
AJS.$('#space-menu-link').hide(); } }); </script> You may also want to hide the Spaces list that is presented on the sidebar. If that is the case, just use the following script instead: <script> AJS.toInit(function(){ if (AJS.params.remoteUser == ''){ AJS.$('#space-menu-link').hide();
AJS.\$('#sidebar-spaces').hide();
}
});
</script>

Related guide: