Skip to content

Search-Results templates ... specialized per Contentype #6997

Answered by ns8482e
MaxGasta asked this question in Q&A
Discussion options

You must be logged in to vote

Search-Result.cshtml creates Display shape for summary for all content items,
@await DisplayAsync(await DisplayManager.BuildDisplayAsync(contentItem, null, "Summary"))

As quick workaround, I believe you can change ”Summary” to specialized shape for your NewsItem content type in Search-Result.cshtml.

e.g. following change will call view Content-NewsItem.NewsItemSummary.liquid

<ul class="list-group">
        @foreach (var contentItem in Model.ContentItems)
        {
             var displayType = "Summary";
             if (contentItem.ContentType == "NewsItem")
                  displayType = "NewsItemSummary";

            <li class="list-group-item">
                   @await DisplayAsync(

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@MaxGasta
Comment options

Answer selected by Skrypt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants