# Listing nested directories

**URL:** <https://discourse.gohugo.io/t/listing-nested-directories/7198>\
**Category:** support\
**Created:** [June 25, 2017, 1:02pm UTC](https://discourse.gohugo.io/t/listing-nested-directories/7198 "2017-06-25T13:02:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Polarhardboiled](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/polarhardboiled/32/22623_2.png) [@Polarhardboiled](https://discourse.gohugo.io/u/Polarhardboiled)\
**Post date:** [June 25, 2017, 1:02pm UTC](https://discourse.gohugo.io/t/listing-nested-directories/7198/1 "2017-06-25T13:02:39Z")

</div>

Hi,

I have the following structure for the content where the section « Projects » is structured with nested subfolders with 2 levels:

```
content
└── Projects
    ├── project-A
    	|-- post-A1
		|_index.md
	|-- post-A2
		|_index.md
    	|-- post-A3
	|-- post-A4
    	|-- _index.md
    └── Project-B
    	|-- post-B1
	|-- post-B2
    	|-- post-B3
	|-- post-B4
    	|-- _index.md

```

How to list only the first level of subfolders, meaning listing only the information from `_index.md` at the first level with the result as follows :

```
-	Project A
-	Project B
-	Etc.

```

With no listing of the post-A1, post-A2, etc…  
Thanks for your help

---

<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:** [June 25, 2017, 1:13pm UTC](https://discourse.gohugo.io/t/listing-nested-directories/7198/2 "2017-06-25T13:13:38Z")

</div>

`(.Site.GetPage "section" "Projects").Sections` should give you the sections you want.

---

<div class="post-metadata">

**Author:** ![Polarhardboiled](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/polarhardboiled/32/22623_2.png) [@Polarhardboiled](https://discourse.gohugo.io/u/Polarhardboiled)\
**Post date:** [July 1, 2017, 11:11am UTC](https://discourse.gohugo.io/t/listing-nested-directories/7198/3 "2017-07-01T11:11:37Z")

</div>

HI,  
Thank you but it doesn’t work.

---

<div class="post-metadata">

**Author:** ![budparr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/budparr/32/749_2.png) [@budparr](https://discourse.gohugo.io/u/budparr)\
**Post date:** [July 1, 2017, 2:20pm UTC](https://discourse.gohugo.io/t/listing-nested-directories/7198/4 "2017-07-01T14:20:25Z")

</div>

@Polarhardboiled Just to make sure, are you doing this (below), and it doesn’t work?

```auto
{{ $sections := (.Site.GetPage "section" "Projects").Sections }}

```

then

```auto
{{ range $sections }}
{{ .Title }} <!-- or whatever -->
{{ end }}

```

---

<div class="post-metadata">

**Author:** ![budparr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/budparr/32/749_2.png) [@budparr](https://discourse.gohugo.io/u/budparr)\
**Post date:** [July 1, 2017, 2:23pm UTC](https://discourse.gohugo.io/t/listing-nested-directories/7198/5 "2017-07-01T14:23:19Z")

</div>

And one more note. I believe the section name is case sensitive, so if your folder name is “projects” make sure you’re using lower case. You can avoid this altogether by using something like this:

```auto
{{ $sections := (.Site.GetPage "section" .Section).Sections }}

```

Note, instead of using `Projects` I used `.Section` which will pick up whatever section you’re currently on.

---

<div class="post-metadata">

**Author:** ![Polarhardboiled](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/polarhardboiled/32/22623_2.png) [@Polarhardboiled](https://discourse.gohugo.io/u/Polarhardboiled)\
**Post date:** [July 2, 2017, 4:34am UTC](https://discourse.gohugo.io/t/listing-nested-directories/7198/6 "2017-07-02T04:34:45Z")

</div>

Thank you
