Question

Coding Help Needed to Display Article Category/Folders in Sidebar

  • 17 September 2022
  • 6 replies
  • 377 views

Userlevel 2
Badge +1

My site has a side bar:

 

Instead of displaying “related articles” which are rarely actually related, I’d like to display the Category/Folder list that the article is inside of.

It’s the same view that is found on the Solutions Home page.

 

However, if I just take the code from the Solutions Home Page and drop it into the article view, it doesn’t work. It displays nothing:

<!--Display Categories and Folders -->
<section class="sidebar content rounded-6 fc-related-articles">
<h2 class="heading">{{ category.name | h}}</h2>
<div class="cs-g-c">
{% for folder in category.folders %}
{% if folder.entity_collection.size > 0 %}
<section class="cs-g article-list">
<div class="list-lead">
{{ folder | link_to_folder_with_count }}
</div>
{{ folder | sub_folder_article_list:5 }}
</section>
{% endif %}
{% endfor %}
</div>
</section>
</section>
<!-- end -->

How do I get this display from the category display page to appear on the article view page?


6 replies

Userlevel 5
Badge +6

Hi @Cheryl,

 

Greetings from the Freshworks community!

 

This can be achieved with the help of portal customization feature. You can reach out to your inhouse developers to customize the same. If you’re looking for some developer assistance from our end who can help you with the customisation part, you can reach out to our support team at support@freshdesk.com but please note that we would be looping in our SI partners to help you with your requirements.

 

Feel free to drop a note here incase of further queries :)

Userlevel 2
Badge +1

@Aishvarya I already reached out to your support team who told me to go hire a developer. When I asked for an updated list of all your liquid placeholders and other tags, they pointed me to an incomplete article in your knowledge base that hadn’t been updated in years.

The fact that FreshDesk expects their clients to hire web developers for even the most minor of portal changes rather than building in a WYSIWIG interface is absurd and out dated.  I can’t even modify the default font size or styles in the portal without knowing how to code. Not all of your clients have developers on staff.

Userlevel 5
Badge +6

@Cheryl 

 

We can certainly understand your concern here. However, I'm afraid that we do not have the scope and expertise at our end to write a portal customization code, and hence we'll have to loop in our third-party developers to help you with the same. Please reach out to our support team at support@freshdesk.com and we’ll take it up right away!

Userlevel 1
Badge +2

To display article categories/folders in the sidebar, you can use HTML, CSS, and JavaScript. First, create a container for the sidebar and use HTML to structure the categories. Then, use CSS to style the sidebar and apply appropriate formatting to the categories. Finally, utilize JavaScript to dynamically populate the sidebar with the categories from your backend or a predefined list. You can loop through the categories and generate the necessary HTML elements to display them in the sidebar.

Badge +6

Not sure @Cheryl was able to find the solution since this thread was started a while ago. But in the recent Marina theme, Freshdesk provided this snippet to show articles in the current folder. 

<section class="mb-20">
<h2 class="mb-12 fs-20 semi-bold">{{ 'portal_translations.solutions.folder_articles' | t }}</h2>
<ul class="fw-no-bullet">
{% for article in article.folder.articles limit:4 %}
<li>
{% element 'link' %}
{
"url": "{{ article.url }}",
"class": "fw-article",
"content": "{{ article.title | escape_once }}"
}
{% endelement %}
</li>
{% endfor %}
</ul>
</section>

If you need further customization, we’re here to help! 😀

Badge

To display article categories/folders in the sidebar, you can use HTML, CSS, and JavaScript. First, create a container for the sidebar and use HTML to structure the categories. Then, use CSS to style the sidebar and apply appropriate formatting to the categories. Finally, utilize JavaScript to dynamically populate the sidebar with the categories from your backend or a predefined list. You can loop through the categories and generate the necessary HTML elements to display them in the sidebar.

Would this work to show/hide service items based on the workspace they’re assigned to?

We’d like our requestors to click the relevant card (Card A, Card B, etc) on the home page, Card A for e.g., the link will take them to the Service Catalog, I’d like to only display items related to Card A at this point.

Reply