How to hide labels in Confluence page using JavaScript in Specific Spaces
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This guide is for informational purposes and is not eligible for support from Atlassian. If you have any questions about the information on this page, please reach out to our community at Atlassian Answers for help.
To hide labels displayed in Confluence page of specific spaces using JavaScript.
Solution
Find out the space key for the spaces in interest by going to Space Tools > Overview.
Navigate to
Confluence Admin >> Custom HTML
Click Edit
Add the following to At the end of the HEAD:
1
2
3
4
5
6
7
<script type="text/javascript">
AJS.toInit(function(){
if (AJS.$('meta[name=confluence-space-key]').attr("content")== '<space_key>'){
AJS.$('#labels-section').hide();
}
});
</script>
ℹ️ Replace the <space_key> above with the actual space key obtained from step 1
Was this helpful?