How to unlist Sub Section from Index Page

This solution is working well if we have Section as content/status but not working for sub section. I.e.: content/status/sub.

I want to unlist posts items published under sub section only (not from content/status), from home/index page. But the same should be accessible with http://sitename.com/status/sub

Thanks.

The post you replied to is from 3 years ago, whereas sub-sections are a recent development. Please consider that when replying to existing topics.

Okay. I am new to Hugo forum. Could you let me know the solution?

Have you studied this function? where

Yes. There is nothing about sub-sections. I want to change from {{ if ne .Section "todo" }} to {{ if ne .Section "code/todo" }}. Where todo is subdirectory under code Section.

{{ define "main" }}
    {{ $paginator := .Paginate (where .Data.Pages "Type" "ne" "page") .Site.Params.Paginate }}
    {{ range  where .Paginator.Pages "Type" "ne" "page" }}
	
	
		{{ if ne .Section "todo" }}


        <div class="article-wrapper u-cf">
            {{  if or (fileExists (print "layouts/partials/content-type/" .Type ".html") ) (fileExists (print "themes/bilberry-hugo-theme/layouts/partials/content-type/" .Type ".html")) }}
                {{ partial (print "content-type/" .Type) . }}
            {{ else }}
                {{ partial "content-type/article" . }}
            {{ end }}
        </div>
		{{end}}
    {{ end }}

    {{ partial "paginator" . }}
{{ end }}

See my answer at: Empty section condition? - #2 by alexandros

And modify your snippet accordingly.

EDIT
This is what I had posted in that thread originally (before I edited my answer). So to exclude a Nested Section try:

{{ $sections := (.Site.GetPage "section" .Section).Sections }}
{{ range where $sections "Params.exclude" "ne" "true" }}