I have upgraded an Umbraco 7 CMS to Umbraco 13.
As part of my custom search endpoint I need to return a path, but the path property returns only a negative number as a string. eg. -1,1440,5787. This is everywhere i use Ubraco Helper. In the Umbraco UI i can see the correct path.
Here is my code for one of the locations, i can work around it everywhere else.
IEnumerable<IPublishedContent> basisSideContentNodes = _umbracoHelper.ContentAtRoot().SelectMany(root => root.DescendantsOrSelfOfType("BasisSide"));
basisSideNodes = basisSideContentNodes
.Where(node => node.Name.ToLower().Contains(query.SearchTerm.ToLower()) ||
node.Value<string>("tekst").ToLower().Contains(query.SearchTerm.ToLower()))
.Select(node => new SearchResult
{
Id = node.Id,
Name = node.Name,
Content = node.Value<string>("tekst"),
Path = $"/{node.Path}"
}).ToList();
Please help me. Is there a way to get the path on the backend?
I expected it to return a string with the path to the node.
Turns out there is a URL method on IPublishedContent. IPublishedContent Documentation