Display Promoted Articles above Categories

Answered

8 Comments

  • Maggie Ungerboeck
    Community Moderator

    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

    2
  • Juan Pablo Quero

    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.

    0
  • Maggie Ungerboeck
    Community Moderator

    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

    0
  • Karen D Snyder

    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.

    1
  • Juan Pablo Quero

    Hi Karen D Snyder! Yes, that's what I meant. Thank you, I'm going to try it on my KB.

    0
  • Karen D Snyder

    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.

    0
  • Juan Pablo Quero

    Karen D Snyder I just figured it out! Your code worked. Thank you :)

    0
  • Karen D Snyder

    Juan Pablo Quero Glad it works!

    0

Please sign in to leave a comment.

Powered by Zendesk