web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Related Category Articles - Knowledge base templating

(0) ShareShare
ReportReport
Posted on by 5

I am trying to add some functionality to the liquid template for related category. Basically I want to list the articles inside the category on the page.

{% if categoryguid %}
{% assign relatedcategories = knowledge.categories | related: categoryguid, limit %}
{% if relatedcategories.size > 0 %}
<h2>{{ snippets["Category/RelatedCategoryHeading"] | default: resx['Related_Categories_DefaultText'] }}</h2>
<ul class="list-group unstyled">
{% for category in relatedcategories %}
<li class="list-group-item"><a href="{{ category_url | add_query: 'id', category.categorynumber | escape }}" class="title">{{ category.title | escape }}</a>
<!--
List child articles for each of these related categories Title, url, description, id-->
<ul>
<li><a href=”#”>Article 1</a>
<p>description goes here</p>
</li>
</ul>
</li>
{% endfor%}
</ul>
{% endif %}
{% endif %}

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Logan.N,

    If you are in customer self-service portal, you can view related articles through clicking category you want.

     pastedimage1614244690668v1.png

    There are three web pages about category and articles:

    pastedimage1614244715288v2.png

    you can click one category that list in knowledge base-home page, then you will view link of articles that related to the category, click link to view details of articles.

    In fact, there are 2 main Web templates being utilised in customer self-service portal:

    1.Knowledge Base - Home: this lists the categories and creates URLs that pass the category number to the child page

    pastedimage1614245228110v3.png

    {% extends 'layout_1_column' %}
    
    {% block main %}
      {% include 'Page Copy' %}
      {% assign category_url = sitemarkers['Category'].url %}
      {% assign count = count | default: 0 %}
      {% assign categories = knowledge.categories | top_level: count %}
      {% if categories %}
        
    {% for category in categories %} {{ category.title }} {% endfor %}
    {% endif %} {% endblock %}

    2.Category Details: this receives the category number in the id parameter, which is then used to end up getting the GUID of the actually category (this is then substituted into the FetchXML query to retrieve the collection of articles)

    pastedimage1614245520420v4.png 

    {% extends 'Layout 1 Column' %}
    
    {% block breadcrumbs %}
      {% assign categoryid = request.params['id'] %}
      
      {% if categoryid %}
        {% assign category = knowledge.categories | category_number: categoryid %}
        {% if category %}
          {% assign pagetitle = category.title %}
          {% assign categoryguid = category.categoryid %}
        {% else %}
          {% assign pagetitle = resx["Knowledge_Article_Unavailable"] %}
        {% endif %}
      {% endif%}
      {% include 'Breadcrumbs' title: pagetitle %}
    {% endblock %}
    
    {% block title %}
      {% include 'Page Header' title: pagetitle %}
    {% endblock %}
    
    {% block main %}
      {% include 'Page Copy' %}
    
      {% assign category_url = sitemarkers['Category'].url %}
      
      {% assign portallanguagecode = website.selected_language.code %}
      
      {% if categoryguid %}
        {% fetchxml knowledgearticlecategory_query %}
          
            
              
              
              
              
              
              
                
                
                
              
                       
                  
                    
                           
              
              {% if portallanguagecode %}
              
                  
                    
                  
                
              {% endif %}
            
          
        {% endfetchxml %}
        
        {% assign articles = knowledgearticlecategory_query.results.entities %}
        {% if articles.size > 0 %}
          
        {% endif %}
        
        {% include 'Category - Related Categories' categoryguid: categoryguid %}
      {% else %}
        
    {% editable snippets "KnowledgeManagement/ArticleUnavailableMessage" %}
    {% endif %} {% endblock %}

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 96 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans