Try our conversational search powered by Generative AI!

Lars Smeby
Apr 24, 2014
  2179
(6 votes)

Finding pages linking to an UnifiedFile

I’m working on a project where we’re using EPiServer 7.1 and the standard EPiServer Search. The files returned by the search are UnifiedFiles, but we wanted to display where on the site the files are being used.

I had trouble finding anyone else with the same problem, but finally I found a solution, though obsolete in EPiServer 7, in this thread.

I ended up using the code below:

var softLinkRep = ServiceLocator.Current.GetInstance<ContentSoftLinkRepository>();
var softLinks = softLinkRep.Load(searchHit.Url.ToHtmlString());

forech(var softLink in softLinks)
{
    var url = softLink.OwnerContentLink.GetFriendlyUrl();
}

Hope this can help someone!

Apr 24, 2014

Comments

Please login to comment.
Latest blogs
Optimizely Search and Navigation - Part 2 - Filter Tips

Introduction Continuing from Part 1 – Search Tips , today I will share the next part – filter tips. The platform versions used for this article are...

Binh Nguyen Thi | Jul 1, 2024

Integrating HubSpot CRM without the MA Connector

Have HubSpot CRM? Want to push user data into it from Optimizely? Don’t have any personalisation requirements with that data? Don’t want to pay $80...

Matt Pallatt | Jun 27, 2024

Keeping the website secure by updating external packages

Did you see the latest warning from Optimizely to update this package with a critical security warning? https://world.optimizely.com/documentation/...

Daniel Ovaska | Jun 27, 2024

Optimizely CMS image anonymization now available for Linux!

The famous image anonymization add-on for Optimizely CMS, with at least 5 downloads, is now finally available for use on Linux. Supports simultaneo...

Tomas Hensrud Gulla | Jun 25, 2024 | Syndicated blog