Referencing content gadget

A while ago I was talking to some content editors about how they worked with Episerver and what could make their work easier. One of the things they were struggling with is to find out where their content is being referenced. Which pages contain references to the page they are editing? Which pages are using the block they are editing?
Of course for a block this is very easy to check. Just click the link in the yellow bar to see where it is used.

ReferencingContent1

ReferencingContent2
However, I noticed some editors close the yellow bar, therefor losing the link.

For pages there is no easy way to see where they are referenced. There is the dirty way of deleting the page, see the warning and cancel the deletion. That is not the recommended way to work.

So I decided to create a simple gadget that will always display a list of referencing content.

ReferencingContent3

How it’s made

We start with defining a new component:

From our component we will use a ContentQuery to get a list of content items:

The current content Id  (contextId) is passed as a parameter. The most important part of the query is _contentRepository.GetReferencesToContent, which gets the actual list of referencing content items.

The dojo part will use a ContentQueryGrid to call our ReferencingContentQuery and display it in a nice list:

using the template:

There is also some globalization in the gadget using: epi/i18n!epi/cms/nls/referencingcontent
so you can translate the header to your used languages

Simple and effective. Happy content editors.