Custom JS scripting for Confluence Space

Sushmitha
Contributor
February 28, 2023

Hi,

We want to inject custom JS script to help with some customizations for the space. We only want to inject this in a specific space .

Can you please let me know how this is possible?

I  know that there is HTML macro https://confluence.atlassian.com/doc/html-macro-38273085.html

Looks like HTML Macros require us to add script to every page manually. We are looking for a space wide method. 

Is there a way we can do this once but for the whole space ?

 

Thanks

Sushmitha

 

1 answer

1 vote
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 28, 2023

You could do this by creating a new "theme" for Confluence, and embedding your JS in it.  If you then set a space to use that theme, your JS will be used on every page in the space (themes do not affect the admin pages for spaces, nor the global functions like the dashboard and search, but they do apply to every page in a space)

You could also amend the global header page, adding your script(s) so that they run on every page Confluence serves up.  If you need that to be space specific, you will need to encase it in an "if space = x" block to make sure it only runs in certain spaces.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events