Skip to main content
Solved

Coding Help Needed to Display Article Category/Folders in Sidebar

  • September 17, 2022
  • 7 replies
  • 465 views

Forum|alt.badge.img+1
  • Top Contributor
  • 6 replies

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?

Best answer by taazathemes

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! 😀

View original
Did this topic help you find an answer to your question?

7 replies

Aishvarya
Community Debut
Forum|alt.badge.img+6
  • Community Debut
  • 113 replies
  • September 28, 2022

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 :)


Forum|alt.badge.img+1
  • Author
  • Top Contributor
  • 6 replies
  • September 28, 2022

@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.


Aishvarya
Community Debut
Forum|alt.badge.img+6
  • Community Debut
  • 113 replies
  • November 1, 2022

@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!


onemoreroti
Community Debut
Forum|alt.badge.img+2
  • Community Debut
  • 10 replies
  • July 31, 2023

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.


taazathemes
Skilled Expert
Forum|alt.badge.img+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! 😀


Forum|alt.badge.img
  • Apprentice
  • 2 replies
  • November 29, 2023
onemoreroti wrote:

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.


Miss Hulda Moore
Community Debut

This is an interesting approach! I’ve been thinking about improving my sidebar as well, but instead of pulling categories dynamically, I wanted to manually customize the list based on relevance to specific sections of my site. Do you think there's a way to mix both—showing the category/folder structure but also allowing some manual curation?

Also, did you check if the article view page has access to the category object the same way the Solutions Home Page does? Maybe it requires a different way to retrieve the current category?

I’ve been working on organizing content for my site (ambersmenu.com.ph), and I’d love to apply some of these ideas there as well.