Created
September 21, 2016 08:21
-
-
Save leethomascook/c30ec46bce9844a000cf5de81e958bcd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomUmbracoSearchResultCoverter : DefaultUmbracoSearchResultCoverter, IUmbracoSearchResultCoverter | |
{ | |
public bool CanConvert(string contentAlias) | |
{ | |
return contentAlias == "nameOfDocType"; | |
} | |
public override string GetCategory(BaseUmbracoItem currentItem) | |
{ | |
string category = ""; | |
if (currentItem.Parent.Parent != null) | |
{ | |
if (currentItem.Parent.Parent.TemplateId.ToLower() == "newslandingpage" || | |
currentItem.Parent.Parent.TemplateId.ToLower() == "videolandingpage") | |
{ | |
return currentItem.Parent.Name; | |
} | |
} | |
while (currentItem != null && currentItem.Parent != null && currentItem.Parent.Name != "Home") | |
{ | |
category = currentItem.Parent.Title; | |
currentItem = currentItem.Parent; | |
} | |
return category; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment