Page include macro

Dear forum,

I use the page include macro to pull content from space A to B. Content comes up fine but the links (all relative links) still point to space A. I want the relative links to point to the current space, which is B.

Do you guys know any macros to do what I'm describing please?

1 answer

0 vote
David Simpson Community Champion Jul 01, 2013

Perhaps you should build a simple user macro to do this job.

For example this user macro will link to a couple of pages in the current space:

## Macro title: Some kind of formatting macro
## Macro has a body: N
## Body processing: n/a
## Output: HTML
##
## Developed by: David Simpson, AppFusions
## Date created: 2013-07-02
## Installed by: My Name

## @noparams 

#set($spaceKey = $content.getSpace().key) 
<ul>
  <li><a href="/display/$spaceKey/Some+Page">Some page</a></li>
  <li><a href="/display/$spaceKey/Some+other+Page">Some other page</a></li>
</ul>

Thanks David. Unfortunately, I am not good with code. Do you have a sample code to do the work please? I need to be able to get content from a different space so that the relative links point to the new space rather than the original one.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted 2 hours ago in Off-topic

Friday Fun: Board Games

Hey everyone!  Background: I had a power outage that knocked out my internet woohoo. Since my job is primarily working remote this meant no work, so I went searching for coffee shops to vi...

20 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you