# Exclude Nested Section by Type

**URL:** <https://discourse.gohugo.io/t/exclude-nested-section-by-type/10079>\
**Category:** support\
**Created:** [January 18, 2018, 6:53pm UTC](https://discourse.gohugo.io/t/exclude-nested-section-by-type/10079 "2018-01-18T18:53:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [January 18, 2018, 6:53pm UTC](https://discourse.gohugo.io/t/exclude-nested-section-by-type/10079/1 "2018-01-18T18:53:32Z")

</div>

Since `Type` is now respected for list pages. How can I exclude a Nested Section and its contents based on `Type`?

Example `_index.md` front matter: `type = "private"`

---

<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:** [January 18, 2018, 7:07pm UTC](https://discourse.gohugo.io/t/exclude-nested-section-by-type/10079/2 "2018-01-18T19:07:09Z")

</div>

Your question has nothing to do with 0.33 and type. It has always been possible to use `Type` in queries – but now also for layout selection.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [January 18, 2018, 7:17pm UTC](https://discourse.gohugo.io/t/exclude-nested-section-by-type/10079/3 "2018-01-18T19:17:20Z")

</div>

Ok. I changed the topic title, since you think that this has nothing to do with Hugo 0.33.

But the question stands. I have tried and _failed_ to filter a Nested Section by Type.

The following renders empty in sitemap.xml, (no errors in the console):

```
{{ $sections := (.Site.GetPage "section" .Section).Sections }}
{{ range where $sections "Type" "!=" "brand" }}
{{- range $i, $e := .Data.Pages -}}

```

For a Section it’s very easy to exclude. But for a Nested Section I really don’t know how to do it.

So anyone?

---

<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:** [January 18, 2018, 7:19pm UTC](https://discourse.gohugo.io/t/exclude-nested-section-by-type/10079/4 "2018-01-18T19:19:28Z")

</div>

OK, maybe it _can be_ related to your problem. But I don’t see it. You can set the `layout` to an empty/non-existing template, but it will still render your regular pages in that section.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [January 18, 2018, 7:24pm UTC](https://discourse.gohugo.io/t/exclude-nested-section-by-type/10079/5 "2018-01-18T19:24:18Z")

</div>

Ok. I figured that much. Thank you for the reply.
