How to hide labels in Confluence page using JavaScript in Specific Spaces
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
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.
Purpose
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:
<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