@if (count($categories))
@php
$list_open = false;
@endphp
@foreach($categories as $category)
@if (!$category->expand || (empty($category->categories) && !$category->getArticlesCount(true)) || !empty($no_expand))
@if (!$list_open)
@php
$list_open = true;
@endphp
@endif
@else
@if ($list_open)
@php
$list_open = false;
@endphp
@endif
{{ $category->name }}
@if ($category->description)
{{ $category->description }}
@endif
@if (count($category->categories))
@include('knowledgebase::partials/frontend/category_panels', ['categories' => $category->categories, 'no_expand' => true])
@else
@include('knowledgebase::partials/frontend/articles', ['articles' => $category->articles_published, 'category_id' => $category->id])
@endif
@endif
@endforeach
@endif