Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Does Confluence have a plugin or macro that shows 'Where Used' information?

Raymond Jorgensen November 30, 2015

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.

2 answers

1 vote
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 30, 2015

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() > 0)
    #if($paramShowTitle == true && $paramTitle && $paramTitle != "")
<p id="referring-content-title$content.id" class="referring-content-links-title">$paramTitle</p>
    #end
<ul id="referring-content-page$content.id" class="referring-content-links" style="display: none;">
    #foreach($page in $pages)
        #if (!$page.isDeleted())
    <li><a href="$page.getUrlPath()">$page.getTitle()</a></li>
        #end
    #end
</ul>
#end
 
<style type="text/css">
.referring-content-links-title {font-weight: bold;}
</style>
 
<script type="text/javascript">
AJS.toInit(function() {
    var hideOnInclude$content.id = $paramHide;
    var originalPage$content.id = '$content.id';
    
    if(hideOnInclude$content.id && 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');
    }
});
</script>
Milo Test
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 1, 2015

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.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2015

I'm not quite understanding what you are asking in regards to the checkbox.

Milo Test
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2015

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.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2015

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.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2015

Ok. I think I've worked something up that should work. I've edited the above code.

Milo Test
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2015

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.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2015

K. Edit is above.

Milo Test
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2015

Nice! But I think Hide on include should hide the title too.

Raymond Jorgensen December 3, 2015

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.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 3, 2015

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

0 votes
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 30, 2015

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).

Raymond Jorgensen December 1, 2015

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.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 1, 2015

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events