Does Confluence have a plugin or macro that shows 'Where Used' information?
Asked by Raymond Jorgensen:

Does Confluence have a macro or plugin that allows you to post a listing of where an article is reference in other articles? I'd like to create a definitions/ acronym listing, and a "Where Used" capability similar to that found in MediaWiki would be useful to show where the terms are being used elsewhere in the library.


Answers:
author: Davin Studer
body: Not sure I totally understand what you are asking, but are you looking for a referring content macro? If so here is a user macro that will do that. If that is not what you are asking then sorry.

***Update: Added title, show title, and hide on include parameters.***

**Macro Body Processing:**   
No macro body

**Template:**

```
## Developed by: Davin Studer## Date created: 06/26/2014## @param Title:title=Title|type=string|required=false|default=Referring Content|desc=The title for the list.## @param ShowTitle:title=Show title|type=boolean|required=false|default=true|desc=Show the "Pages that link here" title for the list.## @param Hide:title=Hide on include|type=boolean|required=false|default=true|desc=If this page is included on another page then hide the referring content links.?#set($containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager'))#set($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null))#set($containerManager=$getInstanceMethod.invoke(null,null))#set($containerContext=$containerManager.containerContext)#set($linkManager=$containerContext.getComponent('linkManager'))?#set ($d = '$')#set ($pages = $linkManager.getReferringContent($content))?#if($pages.size() &gt; 0)    #if($paramShowTitle == true &amp;&amp; $paramTitle &amp;&amp; $paramTitle != "")&lt;p id="referring-content-title$content.id" class="referring-content-links-title"&gt;$paramTitle&lt;/p&gt;    #end&lt;ul id="referring-content-page$content.id" class="referring-content-links" style="display: none;"&gt;    #foreach($page in $pages)        #if (!$page.isDeleted())    &lt;li&gt;&lt;a href="$page.getUrlPath()"&gt;$page.getTitle()&lt;/a&gt;&lt;/li&gt;        #end    #end&lt;/ul&gt;#end?&lt;style type="text/css"&gt;.referring-content-links-title {font-weight: bold;}&lt;/style&gt;?&lt;script type="text/javascript"&gt;AJS.toInit(function() {    var hideOnInclude$content.id = $paramHide;    var originalPage$content.id = '$content.id';   ?    if(hideOnInclude$content.id &amp;&amp; originalPage$content.id != AJS.params.pageId) {        AJS.${d}('#referring-content-page${content.id}').css('display', 'none');    } else {        AJS.${d}('#referring-content-page${content.id}').css('display', 'block');    }});&lt;/script&gt;
```

comments: author: Milo Test
body: This works great; thank you Davin! The only thing I'd like to see is a checkbox to hide the results from where the page is used as an include, or hide from view completely. I just used the Page Properties macro which has a Hide checkbox to keep it from appearing, and since the results are listed when editing the user macro, the report is just what I needed.


author: Davin Studer
body: I'm not quite understanding what you are asking in regards to the checkbox.


author: Milo Test
body: So I have a snippet that I use in an Include Page macro on another page, if that snippet page includes your Referrer Report user macro (as I call it), then the list of pages produced by the user macro also appears on the page using the Include Page macro. I would like the list of pages to NOT show up when the containing page is included elsewhere.I suppose I could put the snippet text into an Excerpt macro and use the Include Excerpt macro instead of the Include Page macro; it would just take time to redo all the reusable content.


author: Davin Studer
body: Ah got it. Hmm ... off the top of my head I'm not sure there would be a way to code that into a user macro. I'll give it some thought, and see if I can work something up.


author: Davin Studer
body: Ok. I think I've worked something up that should work. I've edited the above code.


author: Milo Test
body: Brilliant! One last humble request; the option to display a title of the report: Even a static "Pages that link here" so that it's clear what the list represents.


author: Davin Studer
body: K. Edit is above.


author: Milo Test
body: Nice! But I think Hide on include should hide the title too.


author: Raymond Jorgensen
body: Unfortunately, I am not a Wiki developer, but rather a Wiki user/author, so I'm looking more for a canned technology added to the "Insert More Content" \| "Other Macros" toolbar in Confluence. I wouldn't know what to do with raw code.


author: Davin Studer
body: Once this is added as a user macro by a system admin it will show up in the macro browser as a regular macro.


author: Stephen Deutsch
body: Last I checked, there is an "incoming-links" macro as part of the Confluence Linking plugin: <https://marketplace.atlassian.com/plugins/net.customware.confluence.plugin.linking/server/overview>

Don't forget you need to get the free license from ServiceRocket before using it (you can find a link under "Documentation" on the Marketplace page).

comments: author: Raymond Jorgensen
body: No, not looking for incoming-links, but rather outgoing links. 'What links here?' is another term I've seen. For example, I could create a Wiki article titled "verification" where we define the term "verification". Other articles can reference the verification article in the body of the text. At the bottom of the "verification" article, you can add a "Where Used/What Links Here" macro that shows articles where "verification" was referenced. It's an interesting technique of threading articles together via a glossary. Especially useful for acronym listings.


author: Davin Studer
body: The user macro I provided below will do what you want. It will show you referring links (pages that link to the current page). This will obviously only work for wiki links. Anything external to the wiki or links in the wiki created as "Web Links" won't show.