Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to find all pages that link to a specific attachment?

I have several pages with dublicated attachments. But how do I find out which attachments haven't got any incomming links? In other words how do I find pages that link to a specific attachment?

3 answers

Hi Tom,

This can't be done through Confluence UI yet. If you have access to the database, you can run this query to find the page/blog that link to specific attachment:

select s.spacename, c.title, c.contenttype from content c inner join spaces s on c.spaceid = s.spaceid where c.contentid in (select contentid from bodycontent where prevver is null and body like '%filename="filename.ext%');

Change the filename.ext to the name of attachment (e.g.: README.txt).

Regards,
Samuel

Thank you for your reply. I do have database access, but the query you suggest will not work as there are likely to be many pages in a space with attachments with same filename, for instance 'readme.txt'.

Also a sql query is not very applicaple for the average confluence users.

Do you know if there is a JIRA request to fix this?

It seems odd that links to attachments are not listed on the 'page information' page, and that you get no warning when deleting a page if there are other pages with links to attachements on the page being deleted.

@Samuel Patrice Rompas [Atlassian]'s reply back in 2014 mentioned this can't be done through Confluence UI yet - is this feature on the Roadmap? It would be very useful to be able to display a list of all the pages in a space that link to a specific attachment - for example, via an 'incoming links' information section, perhaps under 'Properties'.

The use-case would be to see at a glance which pages an image has been used on. This would save time in my situation when updating screenshots in technical documentation. Thanks

It's 2020 now and I am finding this old question while having the same issue. Any news on this?

0 votes

If you are a plugin developer, you can do that in a plugin by using a plugin available bean `linkManager` and its method getReferringContent(). Follow these steps:

ContentEntityObject container = attachment.getContainer();
Collection<ContentEntityObject> referringContent = linkManager.getReferringContent(container);

You can then just look at the current ContentEntityObject's in case you are interested in current objects only and not the old page revisions using:

referringContent
.filter(ContentEntityObject::isCurrent)
.collect(Collectors.toSet())

Happy Coding!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

⚡️NEW Group for Confluence Cloud Admins

Calling all Confluence Cloud Admins!  We created a new Community Group to support your unique needs as Confluence admins. This is a group where you can ask questions, access resou...

144 views 2 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you