# Some Sections not showing in Hugo

**URL:** <https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719>\
**Category:** support\
**Created:** [August 21, 2020, 8:53am UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719 "2020-08-21T08:53:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 21, 2020, 8:53am UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/1 "2020-08-21T08:53:32Z")

</div>

I’m trying to create a sidemenu that list out sections in all version of docs. It currently list out some sections and leaves out others. I noticed these other sections that fail to list in sidemenu contain `_index.md` in their root. For experimental purposes, I deleted those`_index.md` files and sidemenu was able to list all sections appropriately.How do we make sidemenu list out all the sections without deleting these`_index.md` files?

My code below:

```auto
{{ range .Site.Sections }}
  {{ $versionDocsPage := . }}
  {{ $versionDocsUrl := .RelPermalink}}
  <nav class="docs-menu collapse d-lg-block"> 
    {{ if in $currentPageUrl $versionDocsUrl }}    
      {{ range (.Pages.GroupByParam "menu").Reverse }}
        <div class="sidemenu-docs">
          <input type="checkbox" id="menuinput-{{ .Key }}" class="menuinput" {{if eq .Key "thanos"}} checked {{end}}/>
          <label for="menuinput-{{ .Key }}" class="menulabel-docs">
            <h5 >{{ .Key }}</h5>
            <img class="caret-expand" src="/expand.svg" alt="expand" />
          </label>        
          {{ range .Pages }}
          <div class="list-group list-group-flush">
            <a class="list-group-item list-group-item-action list-group-item-docs py-1" href="{{ .Permalink }}">{{ .Title }}</a>
          </div>
          {{ end }}
        </div>
      {{ end }}
    {{ end }}
  </nav>
{{ end }}

```

---

<div class="post-metadata">

**Author:** ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)\
**Post date:** [August 21, 2020, 9:38am UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/2 "2020-08-21T09:38:02Z")

</div>

> **[Content Sections](https://gohugo.io/content-management/sections/#nested-sections)**
>
> Hugo generates a \*\*section tree\*\* that matches your content.

sections should have an \_index.md file and content!

Why not using the menu system??

> **[Menus](https://gohugo.io/content-management/menus/)**
>
> Hugo has a simple yet powerful menu system.

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 21, 2020, 9:46am UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/3 "2020-08-21T09:46:54Z")

</div>

@ju52 Because we have different versions of docs, using the menu system results to an error message because Hugo naturally does not support multiple versions of docs

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [August 21, 2020, 10:43am UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/4 "2020-08-21T10:43:38Z")

</div>

Can you share the repository? If not, look at each possible failure point. Here’s the above code simplified:

```auto
{{ range x }}
  {{ if foo }}
    {{ range y }}
      {{ range z }}
        {{ ... }}
      {{ end }}
    {{ end }}
  {{ end }}
{{ end }}

```

Which `range` is failing: x, y, or z?  
Is the conditional (`if`) returning the expected value?

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 21, 2020, 11:13am UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/5 "2020-08-21T11:13:41Z")

</div>

@jmooring This is the link to the repository: [https://github.com/thisisobate/thanos/tree/docs-version/website](https://github.com/thisisobate/thanos/tree/docs-version/website)

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [August 21, 2020, 11:18am UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/6 "2020-08-21T11:18:03Z")

</div>

Please comment:

> Which `range` is failing: x, y, or z?  
> Is the conditional ( `if` ) returning the expected value?

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 21, 2020, 11:29am UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/7 "2020-08-21T11:29:31Z")

</div>

@jmooring from the illustration you gave, range y is failing

Yes, the condition (if) is returning the correct value

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 21, 2020, 11:37am UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/8 "2020-08-21T11:37:23Z")

</div>

@jmooring A much better link to the repository: [https://github.com/thisisobate/thanos/blob/docs-version/website/layouts/partials/\_default/sidemenu.html](https://github.com/thisisobate/thanos/blob/docs-version/website/layouts/partials/_default/sidemenu.html)

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [August 21, 2020, 12:07pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/9 "2020-08-21T12:07:33Z")

</div>

I had hoped to clone the site and run `hugo server` to reproduce the problem, but your project is complex, as is its structure. I do not have the time immerse myself in the details.

You indicated that the failure occurs here:

```auto

{{ range (.Pages.GroupByParam "menu").Reverse }}

```

Looking through your content, I see that:

- docs/components/compact.md has a menu param
- docs/components/\_index.md does _not_ have a menu param

A couple of thoughts:

1. Try adding a menu param to your \_index.md files, or
2. Range through `.RegularPages` or `.RegularPagesRecursive` instead of `.Pages`

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 21, 2020, 12:33pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/10 "2020-08-21T12:33:09Z")

</div>

@jmooring Thanks for the suggestions. I just tried out all the solutions you pointed out for me but unfortunately, none of them worked. Ranging through `.RegularPages` and `.RegularPagesRecursive` were all giving me errors thus stoping the build process. I tried manually adding a menu param to `_index.md` but it didn’t solve the problem

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [August 21, 2020, 12:36pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/11 "2020-08-21T12:36:43Z")

</div>

> [@thisisobate](#):
>
> were all giving me errors

Did you try to troubleshoot the errors?

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 21, 2020, 12:45pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/12 "2020-08-21T12:45:57Z")

</div>

@jmooring not really. The error message weren’t that informative. Would share a snippet shortly

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 21, 2020, 12:48pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/13 "2020-08-21T12:48:48Z")

</div>

```auto
ERROR 2020/08/21 13:47:31 render of "page" failed: execute of template failed: template: _default/single.html:5:19: executing "main" at <partial "_default/sidemenu.html" .>: error calling partial: "/mnt/c/go-projects/src/github.com/thanos-io/thanos/website/layouts/partials/_default/sidemenu.html:13:29": execute of template failed: template: partials/_default/sidemenu.html:13:29: executing "partials/_default/sidemenu.html" at <.RegularPages.GroupByParam>: can't evaluate field RegularPages in type page.Page
```

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [August 24, 2020, 12:51pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/14 "2020-08-24T12:51:27Z")

</div>

I saw that you worked-around this problem by removing \_index.md files in `scripts/website/websitepreprocess.sh`. However, that creates an additional problem: browsing to a URL such as `http://localhost:1313/v0.12/thanos/components/` results in a blank page.

Ranging through `.RegularPagesRecursive` works for me.

Here’s what I did a few moments ago:

```bash
# Clone repository.
git clone https://github.com/thisisobate/thanos
cd thanos
git checkout docs-version

# Revert cbd5ba62656715d609de44867d027a56c2a00485
sed -i 's/^\s\+find.*delete$/:/' "scripts/website/websitepreprocess.sh"

# Preprocess.
./scripts/website/websitepreprocess.sh

# Verify that we have an _index.md to test with.
cat website/docs-pre-processed/v0.12/components/_index.md

# Run hugo server.
cd website
hugo --config hugo.yaml server

```

Now visit [http://localhost:1313/v0.12/thanos/getting-started.md/](http://localhost:1313/v0.12/thanos/getting-started.md/). The left menu has only two sections: Thanos and Contributing.

Now modify line 13 of website/layouts/partials/\_default/sidemenu.html, replacing:

```auto
{{ range (.Pages.GroupByParam "menu").Reverse }}

```

With:

```auto
{{ range (.RegularPagesRecursive.GroupByParam "menu").Reverse }}

```

Then refresh your browser and visit [http://localhost:1313/v0.12/thanos/getting-started.md/](http://localhost:1313/v0.12/thanos/getting-started.md/) again. The left menu now contains all of the sections: Thanos, Proposals, Operating, Contributing, and Components.

Also visit [http://localhost:1313/v0.12/components/](http://localhost:1313/v0.12/components/) and note that the page is not blank.

I’m not sure why your testing of `.RegularPagesRecursive` failed on Friday of last week, but it’s working for me.

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 24, 2020, 1:51pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/15 "2020-08-24T13:51:23Z")

</div>

Hi @jmooring  
I’m wondering the same as to why `.RegularPagesRecursive` didn’t work for me. I’m thinking maybe it’s due to the fact my Hugo version is `v0.72`. I will update my Hugo version and try this approach once again. Would definitely get back to you on the result.

Thanks for all you do @jmooring!

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [August 24, 2020, 1:58pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/16 "2020-08-24T13:58:35Z")

</div>

You are welcome. `RegularPagesRecursive` has been available since v0.68 according to [https://gohugo.io/news/0.68.0-relnotes/](https://gohugo.io/news/0.68.0-relnotes/).

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 24, 2020, 2:01pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/17 "2020-08-24T14:01:10Z")

</div>

wow…I guess it’s not a Hugo version issue

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 24, 2020, 2:03pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/18 "2020-08-24T14:03:36Z")

</div>

> [@jmooring](#):
>
> `{{ range (.RegularPagesRecursive.GroupByParam "menu").Reverse }}`

@jmooring It’s still printing same error message

```auto
Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: _default/single.html:5:19: executing "main" at <partial "_default/sidemenu.html" .>: error calling partial: "/mnt/c/go-projects/src/github.com/thanos-io/thanos/website/layouts/partials/_default/sidemenu.html:13:36": execute of template failed: template: partials/_default/sidemenu.html:13:36: executing "partials/_default/sidemenu.html" at <.RegularPagesRecursive.GroupByParam>: can't evaluate field RegularPagesRecursive in type page.Page
make: *** [Makefile:310: web-serve] Error 255
```

---

<div class="post-metadata">

**Author:** ![thisisobate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thisisobate/32/11400_2.png) [@thisisobate](https://discourse.gohugo.io/u/thisisobate)\
**Post date:** [August 24, 2020, 2:06pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/19 "2020-08-24T14:06:55Z")

</div>

> [@jmooring](#):
>
> `hugo --config hugo.yaml server`

I just ran this instead of the usual `make web-serve` and it worked!

I guess it’s an issue that has to do with our make command I guess…

Thank you so much @jmooring  
Really appreciate all the help

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [August 24, 2020, 2:07pm UTC](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719/20 "2020-08-24T14:07:59Z")

</div>

Thank goodness. This one was complicated. I’m glad it is behind us!

[Next page](https://discourse.gohugo.io/t/some-sections-not-showing-in-hugo/27719.md?page=2)
