Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Render in user macro another page

I have my own macro for include page with specific version. It's works like Confluence Include Macro. But I have a problem: every attachment in included page is not displayed. For example, images shown like "Unknown Attachment", however html elements are ok.

Screenshot from 2021-07-19 11-36-05.png

How to render included page with attachments?

This is my macro:

## @Param Page:title=Page|type=confluence-content|required=true|desc=Select page

## @Param PageVersion:title=PageVersion|type=int|required=true|desc=Write page version

#set ($ss='')
#set ($sp='')

#foreach ($p in $paramPage.split(":"))
#if ($ss=='')
#set ($ss=$p)
#else
#set ($sp=$p)
#end
#end

#if ($sp=='')
#set ($sp=$ss)
#set ($ss=$space.key)
#end

## Get the Page object instance
#set($page=$pageManager.getPage($ss, $sp))
#set($paramPageVersion=$generalUtil.convertToInteger("$paramPageVersion"))
#set($tp=$pageManager.getPageByVersion($page, $paramPageVersion))

#if($page.getId()==$content.getId())
Error! Cannot insert page into itself
#elseif($tp)
#set($body=$tp.getBodyContent().getBody())
$body
#else
Error! Wrong version $paramPageVersion! The latest page version is $page.getVersion()
#end

0 answers

Suggest an answer

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

🏑 Atlympic Event: Confluence

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

175 views 6 8
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