How can I search for where a page is included in Confluence?
Asked by Dave Bacher [analog]:

We use the "Include Page" macro extensively in Confluence for managing content that needs to be consistent across our documentation such as product names and common instructions. Sometimes when editing an included page, it's useful to see where the page is included. Is there any way to search within Confluence for where a page is included? Is there a plugin that provides this sort of advanced search?


Answers:
author: Karl M Kovaciny
body: When I am on a page and choose Page Information from the ... menu, the "Links to this page" section contains pages that include this page.

comments: author: Azfar Masut
body: Thanks!


author: Liz Canham
body: I'm sorry I have no answer to the question, but wanted to bump it up in case anyone else out there has found a workaround solution.

We're placing images and video content in an 'Inclusion Library', as suggested by Sarah Maddox in her book 'Confluence, Tech Comm, Chocolate', but what is not covered in the book is what to do when you update the page in the Inclusion Library. In other words, how do you ensure the updated content is still relevant to the pages where it has been included?

We need to find out where a page has been included. Can anyone help with this please?


author: Steve Goldberg
body: Just came across this post while looking for something else.

If you're willing to do manual work then you can do a search for any macro by doing a search for "macroName: include\*" - note that this is case-sensitive. It will list every page which uses that macro. You can't, AFAIK, add parameters (e.g., which specific include page you're looking for), but at least you can find out every page that has an include.

For more info: <http://ffeathers.wordpress.com/2011/11/04/how-to-search-confluence-for-usage-of-a-macro/>

comments: author: Dave Bacher [analog]
body: Thanks, that's a good tip. We use the include macro so heavily that knowing a list of pages that contain includes isn't enough (there are hundreds), its necessary to find the list of pages that (recursively) include a given target.


author: Matthew J. Horn
body: I would write a macro. Here are the steps that should help you get started:

1. Get the root page of the space.

2. Load a sorted list of all child pages. Each page will be a ContentEntityObject. API details here: <http://docs.atlassian.com/atlassian-confluence/latest/com/atlassian/confluence/core/ContentEntityObject.html>

3. Iterate over each page in the list.

4. On each iteration, call the getAttachmentsNamed() method on the page, and pass in the current page's name as the String argument. See the API for more info: <http://docs.atlassian.com/atlassian-confluence/latest/com/atlassian/confluence/core/ContentEntityObject.html#getAttachmentNamed(java.lang.String)>

comments: author: Dave Bacher [analog]
body: Interesting idea. I didn't know macros could do so much. To get started, I stole some code from "List attachment on another page", but I don't see any of my included pages in the list of attachments.


author: Matthew J. Horn
body: You know what, I think I misread your original post. Not sure if there's a way to find included pages (at least, not as attachments). There are a bunch of isIncluded() and similar sounding methods in the API, but without much doc on them, it's hard to tell if any would work.


author: Dave Bacher [analog]
body: In case my solution is useful to anyone else, I wrote my own "search engine" in python using the XML-RPC API to index content from all pages. It has a simple web interface that links to all pages that include a given target page.

I'm sure there's a more efficient way to do this with a Confluence plugin (or Gadget?), but I haven't yet figured out where to get started with that.


Tags: include