It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Hide header elements for anonymous users? Edited

I'd like to remove these elements from the Confluence header for anonymous/unregistered users:

menu 1.png

menu 2.png

"Log in" can stay.

I've looked at these resources, but I'm still unable to identify exactly what these elements are:

I know how to remove the entire header, but I'm hoping I can avoid that for this reason:

https://community.atlassian.com/t5/Confluence-questions/How-to-modify-the-breadcrumb-navigation-bar-for-Confluence-from/qaq-p/1016421

Sorry if this question is lazy and/or bad practice. If anyone can recommend an app to accomplish this, please let me know too.

Feel free to tell me I'm barking up the wrong tree entirely.

Thanks!

2 answers

1 accepted

1 vote
Answer accepted

Hello Maja,

Thank you for providing details into what elements of Confluence you’re wanting to hide.

I tested out a few CSS options and found the following works when applied as a global stylesheet to Confluence. This example would apply to all users.

#main-header-placeholder {display:none;}
#header-precursor {display:none;}
#header {display:hidden !important;height:40px; }
div.aui-header-primary {display:none !important; }
div.aui-header-secondary .aui-nav #search-ui {display:none }
#main-header {display:none;top:0px;left:0px; }
#metadata-history-dialog-link { display:none; }

However, when I attempted to apply this via Custom HTML with Javascript, it did not come out as desired. The top bar shrunk and I was unable to adjust its size via javascript alone. Here is the Javascript I used;

<script>
AJS.toInit(function(){
if (AJS.params.remoteUser == ''){
AJS.$('div.aui-header-primary').hide();
AJS.$('div.aui-header-secondary .aui-nav #search-ui').hide();
AJS.$('#header').setAttribute("style","height:40px");
}
});
</script>

While this is not a complete solution, you do have an option of using the CSS stylesheet or finishing the javascript portion to have it adjust the size of the header bar.

I hope this proves helpful and gives some direction on hiding elements from anonymous users.

Regards,
Stephen Sifers

Hi Stephen-- thank you so much for putting this together. I have not yet tried it, but I'm sure its a great starting point.

In the meantime, I have also been looking into theme add-ons, and I've found it frustrating how while most allow different themes for different spaces - I've not found one that allows you to maintain the default Confluence theme for some spaces, while applying a custom theme to others.

I'm not responsible for all of my team's internal documentation and project spaces, just our customer-facing spaces (KBs). The default Confluence theme is perfectly fine and what people are used to internally, so there is no need to change it.

All I need is the ability to tweak the Confluence theme to be more appropriate for anonymous viewers.

Anywho, I just wonder if I'm missing something or going about this in completely the wrong way-- because this use case does not seem so uncommon to me.

Thanks again though!

Like Zak_Laughton likes this
1 vote

Please click the settings icon on the top right corner, from the drop down menu, click on general configuration. Find the section "Look and Feel" and click Cusom HTML. Click on edit button and paste the following code on the head section and save.

<script>
AJS.toInit(function(){
if (AJS.params.remoteUser == ''){
AJS.$("#space-tools-menu-trigger").hide();
AJS.$(".aui-header-logo-device").hide();
AJS.$("#space-menu-link").hide();
AJS.$(".aui-buttons").hide();
AJS.$("#search-ui").hide();
AJS.$("#action-menu-link").hide();
}
});
</script>

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

327 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you