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

Brad Mease
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 26, 2012

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
Jeremy Largman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 29, 2012

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.

Brad Mease
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 29, 2012

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?

Jeremy Largman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 29, 2012

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

./confluence-project/confluence-core/confluence-webapp/src/main/webapp/includes/js/contentnamesearch.js

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
TAGS
AUG Leaders

Atlassian Community Events