Looking up & Displaying Specific Category / Article information
How-to guide on displaying/looking up specific categories or articles/questions.
Usage
Looking up a specific category or article is helpful if you wish to loop through a specific category and it's children (great for tree navigation, etc.) and display it on your knowledge base.
Examples of uses:
- Tree navigation - Look up a category, and list all it's children
- Displaying a specific style for a category or article ID.
- Displaying articles such as 'latest features' or 'notices' on the index page or main layout as a form of announcements.
Looking up a specific Article/Question.
In your customization page, on any liquid template (main layout, index, category, question, thanks or contact page), you can write the following:
{% find_question questionID %} <h1> the name of the referenced question is {{ question_questionID.name }} </h1>
As you can see, you do NOT need to close this as you would close an IF statement or a FOR loop. You just run it as is. You'd replace "questionID" with the ID of the question -- see example below.
Looking up a specific Article/Question.
In your customization page, on any liquid template (main layout, index, category, question, thanks or contact page), you can write the following:
{% find_questions 123, 456 %} {% for question in found_questions %} {{ question.id }} {% endfor %}
As you can see, you do NOT need to close this as you would close an IF statement or a FOR loop. You just run it as is. You'd replace "questionID" with the ID of the question -- see example below.
Example: Rendering an announcement article
On your Main Layout or Index page, to display the answer of the article/question with the id '1234':
<h1>Latest Feature Releases: </h1> {% find_question 1234 %} <p class='latest-releases'> {{ question_1234.answers.first.body }} </p>
Looking up a specific Category/Topic.
In your customization page, on any liquid template (main layout, index, category, question, thanks or contact page), you can write the following:
{% find_category categoryID %} <h1> the name of the referenced category is {{ category_categoryID.name }} </h1>
Syntax is identical as for questions/articles. As you can see, you do NOT need to close this as you would close an IF statement or a FOR loop. You just run it as is. You'd replace "categoryID" with the ID of the category -- see example below.
Looking up categories by ID
In your customization page, on any liquid template (main layout, index, category, question, thanks or contact page), you can write the following:
{% find_categories 123, 456 %} {% for category in found_categories %} {{ category.id }} {% endfor %}