Display Promoted Articles above Categories
답변함Good day all,
Is it possible to display 'Promoted Articles' above the Categories, on the KB home page?
-
Hi Scott,
You should be able to move the promoted article code above the category code on your home_page.hbs template. This is using the standard Copenhagen theme but what your code will look like:
Thanks,
Maggie -
Hi Maggie Ungerboeck! I'm using Copenhagen theme and I want to know if there's any class like article.category so I can catch the category from an article. I'm moving the promoted articles to the category page but I want to show only the promoted articles from each category.
-
Hi Juan,
Your question has exceeded my very simple technical abilities:) I'll reach out to some other moderators though and see if they can help you out.
Thanks!
Maggie
-
Juan Pablo Quero are you asking how to show the promoted articles in the category on the category page? If so, I have this code in category_page.hbs that displays links to the promoted articles in the category:
<!-- Promoted articles-->
<div class="resource-items">
<p class="resources-heading">Top Self-Help Articles</p>
<!-- Promoted articles in this category -->
{{#each sections}}
{{#if articles}}
{{#each articles}}
{{#if promoted}}
<div class="resource-item">
<a href="{{url}}"> {{title}} </a>
</div>
{{/if}}
{{/each}}
{{/if}}
{{/each}}
</div>You would need to replace the classes with your own classes.
-
Hi Karen D Snyder! Yes, that's what I meant. Thank you, I'm going to try it on my KB.
-
Juan Pablo Quero did you put the code in category_page.hbs, and get an error message that the objects don't exist? According to https://developer.zendesk.com/apps/docs/help-center-templates/category_page, the sections object is available in the category page template as an array of section objects, and according to https://developer.zendesk.com/apps/docs/help-center-templates/objects#section-object, the section object contains the articles object.
Which Zendesk plan do you have? Not sure if it makes a difference, but maybe it does.
-
Karen D Snyder I just figured it out! Your code worked. Thank you :)
-
Juan Pablo Quero Glad it works!
댓글을 남기려면 로그인하세요.
8 댓글