Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Hide header elements for anonymous users?


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:

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.


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;

if (AJS.params.remoteUser == ''){
AJS.$('div.aui-header-secondary .aui-nav #search-ui').hide();

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.

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

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.

if (AJS.params.remoteUser == ''){

@Neetam Limbu is this still working for you?  And is it Cloud or Server you're using?

It seems the "Custom HTML" option is no longer available??

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

773 views 5 21
Read article

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