Locate all page(s) using a certain media library asset

Dan . asked on April 26, 2018 15:01

Hi,

Is there a way for a CMS editor to identify all locations where a certain media library image asset is being used?

Running Kentico 10...

Thanks

Recent Answers


Rui Wang answered on April 26, 2018 15:23

It's not easy, but doable. If you want to located all the regular pages that has a image embedded as content, you would do a SQL search for the file name against CMS_DocumentTable > DocumentContent column.

But if you have other page types that has a media select field that editor could select an image, you will have to search against those custom table for each page type as well.

You can create a custom report using Reporting application for editor to search, but the SQL script can be complex depending on what kind page you want to search.

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on April 26, 2018 15:38

I don't think you can do it with a SQL. The sure way is find some SEO crawling tool (trial version) that will let you scan your site and then you can query the results for given URL.

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on April 26, 2018 15:44

Peter, try insert an image into an Editable Text area of a page. Then try this SQL

SELECT DocumentID
      ,DocumentName
      ,DocumentNamePath
  FROM CMS_Document
  where DocumentContent like '%name.jpg%' AND DocumentCulture = 'en-us'
0 votesVote for this answer Mark as a Correct answer

vasu yerramsetti answered on April 26, 2018 15:51

DanS, You can run below stored procedure in your database and to search the whole database for a string in the tables. This stored procedure will return the tables and result set with the matching search string.

https://gallery.technet.microsoft.com/scriptcenter/c0c57332-8624-48c0-b4c3-5b31fe641c58

i hope it helps you

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on April 26, 2018 15:54 (last edited on April 26, 2018 15:59)

Rui, what if this is a repeater or some custom c# code? There are 100 ways I can render an image. We can't assume or guess how URLs and images rendered on a web site. You have to scan the web site output with crawl tool. Scanning DB is useless :)

P. S. Yes. If you use editable text, or widgets then you can check DocumentContent or DocumentWebParts

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on April 26, 2018 16:02 (last edited on April 26, 2018 16:02)

Repeater pulls data from page type, that's why I mentioned search page type tables is also needed.

Assuming his intention was to locate the source page that contains the reference to the image, not any dynamic pages that could show this image while using web parts like repeater to display a source page.

Like I said, it's doable, but not easy, depending how they setup the site and use the image.

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on April 26, 2018 16:42

I've tried to do it once, but it was a bit too crazy.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.