Search for links


(Catherine Driessen) #1

Is there a way to search for links within your site which point to a URL containing a particular string (eg. www.example.com) and for the search results to display all assets which contain these links (whether it be a standard page or a redirect asset)?
(Note that the links may not contain the string in the link text and instead may only contain the string in the HTML tags)


(Avi Miller) #2

Not with the default Search package -- the search index strips out all the HTML before indexing, so we do not store the content of the <a href> links stored inside content. You could potentially do it with a custom DB Data Source bridge, though. You'd need to speak to Squiz Support about that, because it'd be a fairly complicated configuration.

(Michael Wilson) #3

I know this is an old post but I have the same requirement and I can’t see that there is a solution for this. I need to find all links to a particular URL and update them.

Couldn’t the links report be updated to include the option to only report links with specified text or href values?

I’ve worked with other systems before where I needed to search for all occurrences of phone numbers, department names or hyperlinks that needed to be updated, as they were defined in multiple places (bad practice I know), and the CMS provided a facility for this.


(Peter McLeod) #4

Hi
Could use a listing with a keyword check that print the id (or whatever) if the link is found, such as:
%asset_contents_raw^contains:www.url.com:{asset_assetid}:%
Not the most efficient method but might get you what you need.
Thanks
Peter


(Michael Wilson) #5

Thanks Peter, that does the job.


(Bart Banda) #7

The Search and Replace tool could potentially do this for you? Have you tried that? https://matrix.squiz.net/manuals/tools/chapters/search-and-replace-tool


(John gill) #8

I believe the Search and Replace tool relies on SearchManager/sq_sch_idx for searching, which doesn’t index non-text things like the URLs in a[href] attributes, so it wouldn’t be able to find them.