Add status to search results for Community posts

답변함


2021년 3월 23일에 게시됨

Is there any way to add the status of community posts on the search results page?

I tried to use the examples below to customize `search_results.hbs`

 

     {{#if results}}
<ul class="search-results-list">
{{#each results}}
<li class="search-result-list-item result-{{type}}">
<h2 class="search-result-title">
<a href="{{url}}" class="results-list-item-link">{{title}}</a>
</h2>
<div class="search-result-icons">
{{#is status 'none'}}
{{else}}
<span class="search-result-status status-label-{{status_dasherized}} status-label striped-list-status">
{{#is post.status 'not_planned'}}Gathering Feedback{{/is}}
{{#is post.status 'planned'}}In the Works{{/is}}
{{#is post.status 'answered'}}Officially Answered{{/is}}
{{#is post.status 'completed'}}Implemented{{/is}}
</span>
{{/is}}
{{#if vote_sum}}
<span class="search-result-votes">
<span class="visibility-hidden">
{{t 'votes_sum' count=vote_sum}}
</span>
<span aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" focusable="false" viewBox="0 0 12 12" class="search-result-votes-icon">
<g fill="none" stroke="currentColor">
<path stroke-linejoin="round" d="M10.77 4.5a.73.73 0 01.73.73C11.43 7 11.21 11.5 10 11.5H5a.5.5 0 01-.5-.5V4.5s1-.5 1-3a1 1 0 012 0v3z"/>
<rect width="2" height="7" x=".5" y="4.5" rx=".5" ry=".5"/>
</g>
</svg>
{{vote_sum}}
</span>
</span>
{{/if}}
{{#if comment_count}}
<span class="search-result-meta-count">
<span class="visibility-hidden">
{{t 'comments_count' count=comment_count}}
</span>
<span aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" focusable="false" viewBox="0 0 12 12" class="search-result-meta-count-icon">
<path fill="none" stroke="currentColor" d="M1 .5h10c.3 0 .5.2.5.5v7c0 .3-.2.5-.5.5H6l-2.6 2.6c-.3.3-.9.1-.9-.4V8.5H1C.7 8.5.5 8.3.5 8V1C.5.7.7.5 1 .5z"/>
</svg>
{{comment_count}}
</span>
</span>
{{/if}}
</div>
<article>
<ul class="meta-group">
<li>
<ol class="breadcrumbs search-result-breadcrumbs">
{{#each path_steps}}
<li title="{{name}}"><a href="{{url}}">{{name}}</a></li>
{{/each}}
</ol>
</li>
<li class="meta-data">{{author.name}}</li>
<li class="meta-data">{{date created_at}}</li>
</ul>
<div class="search-results-description">{{text}}</div>
</article>
</li>
{{/each}}
</ul>

 

6 errors
'status_dasherized' does not exist
not possible to access `post` in `post.status`
not possible to access `post` in `post.status`
not possible to access `post` in `post.status`
not possible to access `post` in `post.status`
'status' does not exist

 

Is there any way to fix this?

reference: Add status to search results for Community posts – Zendesk help


0

1

댓글 1개

The guide is particular about whether or not you have access to the post context depending on the specific page. In this case, it looks like Zendesk does not allow you to access post. 

What I would suggest is doing something like Wes has done in this tip.
https://support.zendesk.com/hc/en-us/community/posts/207738148-Adding-a-notification-banner-to-your-Help-Center-v2

I am sure it will take some customization but he is using vanilla JS to poll the articles. I don't see why you couldn't get the status as well.

0


댓글을 남기려면 로그인하세요.

원하는 정보를 못 찾으셨나요?

새 게시물