0

I am creating a Public Facing Site(Publishing Portal) in Sharepoint 2016. I want to hide two top bars which are shown in the screenshot so that they are not displayed to the end user. How can I achieve that using Sharepoint Server 2016?

Top Bars to be hidden for Public facing site.

2 Answers 2

3

To hide the ribbon as you highlighted for all users, try to add the below CSS in your master page.

#suiteBarTop, #s4-ribbonrow
{
  display: none;
}

For the only suiteBar that contains SharePoint word and colored black, try this

#suiteBarTop
{
  display: none;
}
3
  • Is there any other way , apart from CSS to do this? Feb 4, 2020 at 15:19
  • 1
    @PankajDalvi You could create a custom masterpage and remove the controls that correspond to the parts you don't want to display./
    – Thriggle
    Feb 4, 2020 at 16:21
  • I can do that @Thriggle but what if my Administrator wants to Sign In and Edit the pages. In that case what should I do? Feb 4, 2020 at 16:23
1

Add the following code into tag in master page to achieve it.

<script type="text/javascript">
window.onload = function() {
    if(_spPageContextInfo.userId==undefined){
        document.getElementById("suiteBar").style.display = "none";
        document.getElementById("s4-ribbonrow").style.display = "none";
    }   
}
</script>

Or we can use Security Trimmed Control to achieve it, check the article below.

Add a Security Trim snippet in SharePoint

1
  • Thanks for the code snippet @LZ_MSFT. I think this should help. Feb 5, 2020 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.