Hey guys, here is my results snippet:
@helper RenderContentResult(SearchViewModel model, IPublishedContent result)
{
<div class="ezsearch-result">
<div class="inner">
<h3><a href="@result.Url">@result.Name</a></h3>
<div class="meta">@result.DocumentTypeAlias / <span data-momentify="@(result.GetPropertyValue<DateTime>("publishedDate").ToString("yyyyMMddThhmm"))"></span></div>
<span class="preview">@result.GetPropertyValue("preview")</span>
@foreach (var field in model.PreviewFields.Where(field => result.HasValue(field)))
{
<p>@Highlight(Truncate(Umbraco.StripHtml(result.GetPropertyValue(field).ToString()), model.PreviewLength), model.SearchTerms)</p>
break;
}
</div>
</div>
}
As you can see about a third of the way in I call on
@result.DocumentTypeAlias
is there-a way to get the pretty name for this, ie instead of ‘newsStory’ its ‘News Story’, I did consider a large case statement that just grabbed the Alias, turns it into a pretty var, and chucks it out, but then id have to update this everytime a new category is added.
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/93997-get-a-pretty-document-type-alias-to-show-in-search-results