You are here: Home / Documentation / How To's / How to find referring links to File and Image objects

How to find referring links to File and Image objects

an External Method inspired by Paul Rentschler's pwrentch.FileReferences

Thanks go to Paul Rentschler for his very cool product!

If you want to find what other items on a Plone site refer to (include a link to) a particular File or Image object, create an External Method called "reflist".

To invoke it, append "/reflist" to the URL of the File or Image object, e.g.

It will return a list of clickable URLs for the objects (usually pages) linking to the current object.

The file system code goes into your Extensions folder.  Call it "", with the following contents:

from Products.CMFCore.utils import getToolByName

def reflist(self):
    out = []
    reference_catalog = getToolByName(self, 'reference_catalog')
    references = reference_catalog.getBackReferences(self)
    for ref in references:
        out.append('<li><a href="%s">%s</a></li>' % (ref.getSourceObject().absolute_url(), ref.getSourceObject().absolute_url() ))
    return "\n".join(out)

Create the External Method in your portal_skins/custom folder, with:

  • ID "reflist"
  • module name "reflist"
  • function name "reflist"