How can I get all child categories - of a child category based on url segment? I am missing something very obvious I think. I am trying to get all child categories based on url segment.

For example: "mysite.com/foo"

I have a category Group called Sections Within Sections I have a category called Foo.

Categories:

Sections  &lt;-- Category Group
    |- Foo
        |- One
        |- Two
        |- Three


Using this url as an example: www.mysite.com/foo

twig

{% set categoryGroup = craft.categories.group('Sections').level(1).slug(craft.request.getSegment(1)).first() %}
{% set categories = craft.categories.ancestorOf(categoryGroup) %}


Doing this: &lt;p&gt;Group: {{ categoryGroup }}&lt;/p&gt; 

Renders this: Group: Foo

Great!

{% if categories|length %}
    {% for cat in categories %}
        {{ cat.title }}
    {% endfor %}
{% else %}
    NOTHING
{% endif %}


I am always getting back my NOTHING statement. When I navigate to mysite.com/foo, I would like to show One Two Three
There are a couple of things I would do differently here. The first is to check the Categories in this group have their own URLs box in the Category Group settings. Set the url to {slug}, and you will have category defined in the template without needing:


  {% set categoryGroup = craft.categories.group('Sections')
  .level(1)
  .slug(craft.request.getSegment(1))
  .first() %}


The second problem is that once you have your category, what you want are the children, not the ancestors:

{% set theChildren = category.children %}

{% if theChildren|length %}
  {% for cat in theChildren %}
    {{ cat.title }}
  {% endfor %}
{% else %}
  NOTHING
{% endif %}