{% if categories|length %}
<ul>
    {% for category in categories %}
        {% if category.children|length or category.publishedPosts|length %}
            <li>
                {{ category.name }}
                {% include 'VlabsCmsBundle:Front:Post/list.html.twig' with {posts: category.publishedPosts} %}
                {% include 'VlabsCmsBundle:Front:Category/list.html.twig' with {categories: category.children} %}
            </li>
        {% endif %}
    {% endfor %}
</ul>
{% endif %}