Using attached data as src for CSS and JS inside HTML Macro?

Jo Ro November 2, 2020

Greetings fellow Atlassians, i wanted to ask you whether (and if yes how?) it is possible to link attached files of a confluence page as source for the style / script for my HTML-Script inside of a HTML Macro.

Thank you for your help.

1 answer

0 votes
Vitor LC
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.
November 2, 2020

Hi @Jo Ro ,

If I understood well you have a CSS and JS files attached to a Confluence page and you'd like to use them in your HTML macro. If this is the case, maybe you can add in the macro:

<link rel="styleshhet" href="/your_site_name/download/attachments/page_id/your_styles.css">

<script src="/your_site_name/download/attachments/page_id/your_scripts.js"></script>
  • Your_site_name is the pathname for your site. If the URL to reach Confluence is something like www.johannesrother.com/confluence, /confluence is the pathname
  • You can find the ID of the page with the attachments (page_id) by, for instance, viewing the page information (Tools menu). In the URL you will have something like /your_site_name/pages/viewinfo.action?pageId=page_id (e.g. 52691589). This is the page_id you should use in the path of your link and script tags.

Hope it helps.

Vitor

Jo Ro November 9, 2020

Hi @Vitor LC , 

thank you for your answer. 

Finally i was able to test whether this option is working but sadly it isn't.

Is it possible that empty spaces in the page name have to be decoded for the link?

 

 

Thanks for your help.

Vitor LC
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.
November 12, 2020

Normally not. What are you getting?

Jo Ro November 30, 2020

There was a problem with the spaces in the pages title, but i was able to resolve that problem by substituting them with "+".

 

Sry for the late answer.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events