How can we add a description field under article names in our help center
Hello all,
I'd like to add a description field underneath our articles in the section view before clicking on an article. I've attached a screenshot of what I mean.
We're using the Copenhagen theme for our help center.
We've tried using the 'Labels' field to accomplish this but we can't seem to get it working.
Does anyone have the code to accomplish this?
Many thanks!
-
Hi Marin
Try adding:
{{excerpt article.body characters=100}}
under the article title placeholder... You can of course adjust the number of characters to suit your use case.
-
Hey Carsten,
Thanks for that code there. We're actually trying to show an excerpt underneath the article's name in the section view before clicking on the article. Do you know of a way to accomplish this?
-
Hi Marin
Sorry - Since you are already looping through the articles the code should look like this:
{{excerpt body characters=100}}
-
Hey Carsten,
Thanks for all your help here -- that works great!
Just one more question, is there a way to make it so that the excerpt shows for only a specific section and not all sections?
Thanks again!
-
Hi Marin
The only one i can come up with (keep in mind that i am not a programmer) is this:
If you wrap your excerpt in an is or isnt block you can control when the excerpt is printed, ie.:
{{#is ../section.id 201591998}}{{excerpt body characters=100}}{{/is}}
The down side is that you would have to have an #is line for each section where you want to print the excerpt - I might be easier to use #isnt instead.
-
Hello,
I am trying to add the suggested excerpt: {{excerpt article.body characters=100}} into the Categories template; but, I am getting this error message:- Unable to preview 'Category page' due to invalid reference: {{article.body}} at line 34
Any way I can display an article description on the Categories template?
Thanks!
-
Hello @Yeny Rubiano,
Please use this one on your category template -
{{excerpt body characters=100}}
If face any issue feel free to message us at info@customersupporttheme.com
Thanks
Support Team
http://customersupporttheme.com
(Experts in Zendesk Themes, Zendesk Help Center, Plugins, Help Center Branding and Customization.)
-
Thanks for the help. The excerpt worked on our Category template.
-
@Yeny Rubiano, Thankyou! If need anything feel free to message us.
(Experts in Zendesk Themes, Zendesk Help Center, Plugins, Help Center Branding and Customization.)
-
Hello everyone.
I am trying to add the suggestion given above to the category page template but I cannot make it work.
I am adding the code inside category_page.hbs but cannot see the text that's inside the first article from the bottom.
{{/if}}
<a href="{{url}}" class="article-list-link">{{title}}</a>
<p>{{excerpt body characters=50}}</p>
{{#if internal}}
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" focusable="false" viewBox="0 0 16 16" class="icon-lock" title="{{t 'internal'}}">
<rect width="12" height="9" x="2" y="7" fill="currentColor" rx="1" ry="1"/>
<path fill="none" stroke="currentColor" d="M4.5 7.5V4a3.5 3.5 0 017 0v3.5"/>
</svg>
{{/if}}
</li>
{{/each}}Can you please help?
Emil
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
10 Kommentare