# Calling subsection?

**URL:** <https://discourse.gohugo.io/t/calling-subsection/21504>\
**Category:** support\
**Created:** [October 29, 2019, 3:00pm UTC](https://discourse.gohugo.io/t/calling-subsection/21504 "2019-10-29T15:00:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathanulco](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jonathanulco/32/3037_2.png) [@jonathanulco](https://discourse.gohugo.io/u/jonathanulco)\
**Post date:** [October 29, 2019, 3:00pm UTC](https://discourse.gohugo.io/t/calling-subsection/21504/1 "2019-10-29T15:00:38Z")

</div>

Hello, there’s something I don’t get with section calls.  
I have

```auto
/content
../first-branch
..../child-of-first-branch

```

if i do  
`{{ $firstBranch := where .Data.Pages "Section" "first-branch" }}`  
it’ok page=X  
if if do  
`{{ $child-of-first-branch := where .Data.Pages "Section" "child-of-first-branch" }}`  
not ok page=0

all have \_index.md

What i have missed to call subsection ?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [October 29, 2019, 4:06pm UTC](https://discourse.gohugo.io/t/calling-subsection/21504/2 "2019-10-29T16:06:58Z")

</div>

I think you will find it easier to work with the built-in methods, e.g.:

```auto
{{ $first := .Site.GetPage "first-branch" }}
{{ $children := $first.Pages }} // Pages and sections
{{ $sections : = $first.Sections }} // Sections only

```

With the above and related methods you can recurse down the tree.

---

<div class="post-metadata">

**Author:** ![jonathanulco](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jonathanulco/32/3037_2.png) [@jonathanulco](https://discourse.gohugo.io/u/jonathanulco)\
**Post date:** [October 30, 2019, 10:40am UTC](https://discourse.gohugo.io/t/calling-subsection/21504/3 "2019-10-30T10:40:31Z")

</div>

ok so

`{{ $child-of-first-branch := .Site.GetPage "Section" "first-branch/child-of-first-branch" }}`

and if i want to `range`

`{{ range last 3 $child-of-first-branch.Pages }}`

Thank you master @bep 😉

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [October 30, 2019, 5:16pm UTC](https://discourse.gohugo.io/t/calling-subsection/21504/4 "2019-10-30T17:16:43Z")

</div>

> [@jonathanulco](#):
>
> {{ $child-of-first-branch := .Site.GetPage “Section” “first-branch/child-of-first-branch” }}

I guess the above also works, but this is simpler:

{{ $child-of-first-branch := .Site.GetPage “first-branch/child-of-first-branch” }}

If you have a look at the docs, there are lots of useful section related methods.
