Is it possible to exclude pages from the Confluence Search?
Asked by Jodie Miners:

Is there any way to exclude pages from the confluence search? I love the {cache} macro that allows me to include content in the confluence search, but I would like to be able to exclude pages.

We have a lot of inlcuded content, and I would like to direct the users to the most suitable pages.

Or, if there is not a way to exclude content, is there a way to promote the pages we want the users go go to, to come higher in the search results?


Answers:
author: Jodie Miners
body: OK, here's what I have done, taking Sarah's suggestion from the comments here and the comments on Sarah's blog post.  

on my source pages, I used the {show-to} macro to hide the content to anonymous users, but provide a link back to the main page that contains the linked content. The source page named _MySourcePage will still show up in searches, but there is no content visible on this page except the link to the page where the anonymous user should view the content.  

I also put a panel on top of the page to tell my editors that the content on this page is only visible to them. The Panel is also only visible to the editors, and not to anonymous users.  

The content that is going to be linked, is linked via the {multi-excerpt} macro (a paid plugin - see [my blog post](http://jodiem.com.au/2011/08/13/the-one-thing-in-one-place-once-rule-using-confluence/) about how I'm using linked pages), so when the content within the multi excerpt is included in my LinkedPage, then it is visible to the Anonymous users. Here is my code:  

See \[LinkedPage\] for the contents of this page.  
{show-to:user=editors}  
{panel:title=SourcePage}  
This section or page is linked to \[LinkedPage\]. The Content of this page is visible in {link-to:page edit}Edit Mode Only{link-to}.  
{panel}  
{multi-excerpt:name=_SourcePage}  
Body of Page  
{multi-excerpt}  
{show-to}  

<br />

<br />

Of course, most of this additional content is in a macro, which makes it easy to include on the page. It seems to work well now.   

Let me know if you think there is a better way to achieve this result.


author: SarahA
body: Hallo Jodie

In a recent blog post, Emily added a comment asking a similar question. She had some useful input about the "secure-include" macro, supplied by the Perimeter plugin from Customware. David Peterson also added some useful advice. In combination with the cache macro, this may satisfy your requirements. See the comment chain on this blog post:

<http://ffeathers.wordpress.com/2011/04/03/content-reuse-on-a-wiki-a-case-study/>

Let me know if it works for you. :)

Cheers, Sarah

comments: author: Jodie Miners
body: Hi Sarah, thanks for that. Yes, I had read that excellent post before. It does look like the only way. Unfortunately I had not created my source content in a separate space, and now it would be way to big a job to change it all, so I will have to leave it for now.

I did think of one idea however. On the pages where I'm using the Builder-Show macro to include that content on other pages, I just hide all the content on that source page, so if the search points them to that page, they won't actually see anything. It sort of works, but can be annoying to the user.


author: SarahA
body: Hallo Jodie

Sounds good! The {excerpt} macro also has a parameter that you can use to hide the content on the page where the excerpt is defined.  
`{excerpt:hidden=``true``}A ``short` `summary of ``this` `page{excerpt}`  
As you pointed out, this can be annoying to readers, and even to community authors who want to update the page and wonder where the content is. What I've done sometimes is to write some words on the page, saying that the content is visible when you edit the page or view source. I also add a link to the principle page where the content is used. That helps both authors and the people who came in via Google looking for the actual information.  
Cheers, Sarah


author: Kevin Buchs
body: Jodie,

Don't fear the fact that you didn't create your content in a separate space. You probably have it organized hierarchically. Just move the parent page to the new space and the descends of the parent move with it. It is easy. Move is under the Tools menu on the upper right.


author: Deividi Luvison
body: We also have a feature request [CONF-33161](https://jira.atlassian.com/browse/CONF-33161) raised to address that :).


author: Kevin Buchs
body: You can limit searches to spaces.

You can include labels in searches. This may be what you want, for you can go to the relevant pages and add a label like JodieRecommends and then search for that label.

See the general help on searching in the Conf. documentation.


Tags: search