How can I limit the include page macro to the current space?

We currently have our product releases in their own space with their own inclusion library. After releasing a new version of a product we copy the space with it's own inclusion library to create the next set of documentation for the new release. When one of our employees goes to include a specific page using the include macro the search feature is finding multiple identically named pages for the old inclusion libraries in the now old spaces.

I've tried creating a macro that wraps the include macro but the only option to search for a page is the confluence-content type and that does not have an option to limit the space to just @self.

1 answer

0 votes

it's not exactly what you're after, but you can type in the spacekey first. Also note that if you hover over the page, the link tip can help.

Are you open to build a new plugin/macro? If so you could achieve it by limiting the js search by space.

I've seen the instructions to include the spacekey, but when you add the spacekey the js search stops working. Requiring our users to know the exact title of the page they want to include really slows down their workflow.

I am totally fine creating a plugin or macro but I was unable to find a way to limit the js search by a space. Could you point me in the right direction on how to do that?

Browse to a spaces' blogs, and start searching. you'll notice that the javascript for that is limited to the blogposts in this space. The file that controls this is


In that file is the code snippet for the javascript you're after:

if (spaceBlogSearchQuery.length && confluenceSpaceKey.length) {
        spaceBlogSearchQuery.quicksearch("/json/contentnamesearch.action?type=blogpost&spaceKey=" + 
                AJS("i").html(confluenceSpaceKey.attr("content")).text(), null, {
            dropdownPlacement : quickNavPlacement(spaceBlogSearchQuery)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,104 views 17 14
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