Thursday, 1 October 2015

How To Hide Any Page OR Section from Live Sitecore Website?

Recently came across a very small but interesting question - how to hide any section or page from live website in Sitecore?

Well, as Sitecore is famous for its flexible architecture which can definitely accommodate this requirement. But Sitecore newbies are not aware about it and on top of that - you will not find any answer to this question on internet easily.

Hence thought to share it with this post - I am sure this will really help to beginners!

But before we jump to solution - I have a very small question for you.

Do you know whenever you access Sitecore Website (preview mode), under which user account does your website run?

If you know this answer then your half journey to find the solution is done. Yes - you are thinking right - it's under extranet\Anonymous user account.

So for what are you waiting now? You need to disable read access rights for extranet\Anonymous user account on that item. It's simple but tricky. isn't it?

Here are step by step screen grabs to configure the same which will remove read access rights for extranet\Anonymous user, so that page will NOT be shown on your Sitecore website.

This will open up Access Viewer pop-up window. Make sure that you select extranet\Anonymous user.

Clicking on Assign button will open another pop-up window where you need to remove read access rights.

Finally, click on OK and you are done.

Have a Happy Sitecore Journey!


  1. Please don't do this :'( You should break inheritance and not deny access, otherwise it usually leads to compound issues when a user belongs to multiple roles. Deny access is quite rarely used in my experience. If what you truly want to do is hide the page or section from the live website then the item (or version) should have the Publishable option set to false, which can be accessed via Publish tab > Publishing Restrictions.

    1. Jammy,

      There are two points in requirment:
      1) The section is already published but want to hide it from live site.
      2) It should be visible in page editor mode.

      There is "unpublish" option under Publishing section of Sitecore Item. We can use that field to hide any Sitecore item, but that will ALSO HIDE FROM PAGE EDITOR mode. And I got requirement to HIDE ITEM FROM LIVE site only. That's why need to apply this option.

    2. 1) If the item is already published, even if you change the security you need to republish the item (since the security is set on the item itself). Simply changing the publishing restrictions and republishing will mean the item gets unpublished.

      2) If you make an item not publishable, it should still be visible in Page Editor. The item remains in the master database, it is simply not moved to web db. If it is not visible in Page Editor then that is down to restriction in the code.

    3. "Simply changing the publishing restrictions and republishing will mean the item gets unpublished"
      This will also hide item from Page Editor which is not required.

      Instead of writing code, above solution can help us to achieve this requirement.

    4. I think this is what should be expected. Page Editor should show you what you are about to publish to live site. If it's not showing something that can't be published then that is correct. There is no reason for that item to be visible in the page editor, if there is then that item is being wrongly used in my opinion or needs to have a check to only show in page editor code level. My concern is you do this too much you'll end up with an unwanted matrix of items that are being hidden in an unconventional way. Nightmare for future devs and content editors who may need to work on it. Convention is good!

    5. This is needed for temporary, not permanent.