# Specifying nested menus in config.toml

**URL:** <https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923>\
**Category:** support\
**Created:** [October 12, 2022, 10:12pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923 "2022-10-12T22:12:45Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 12, 2022, 10:12pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/1 "2022-10-12T22:12:45Z")

</div>

In my menu I have these entries:

```auto
[[menu.main]]
    identifier = "about"
    name = "About"
    url = "/about/"
    weight = 300

  [[menu.about]]
    identifier = "expertise"
    name = "Capabilities"
    url = "/about/capabilites/"
    parent = "about"
    weight = 310

  [[menu.about]]
    identifier = "education"
    name = "Education"
    url = "/about/education/"
    parent = "about"
    weight = 320

  [[menu.about]]
    identifier = "projects"
    name = "Experience"
    url = "/about/experience/"
    parent = "about"
    weight = 330

```

There are no submenus on the main menu item ‘About’ and each nested menu’s \*.md file displays as a single paragraph rather than with the H1 heading and a following list. The contents also appear on other pages.

What have I done incorrectly?

Rich

---

<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:** [October 12, 2022, 10:25pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/2 "2022-10-12T22:25:09Z")

</div>

```nohighlight
[[menu.main]]
name = "About"
pageRef = "/about"
weight = 1

[[menu.main]]
name = "Capabilities"
pageRef = "/about/capabilities"
parent = "About"
weight = 1

[[menu.main]]
name = "Education"
pageRef = "/about/education"
parent = "About"
weight = 2

[[menu.main]]
name = "Experience"
pageRef = "/about/experience"
parent = "About"
weight = 3

```

All entries are part of one menu… main.  
You can omit the `identifier` key if there are no duplicate `name` entries.  
Use `pageRef` for internal links, and `url` for external links.

This assumes the following structure:

```nohighlight
content/
├── about/
│ ├── capabilities.md
│ ├── education.md
│ ├── experience.md
│ └── _index.md
└── _index.md

```

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 12, 2022, 11:03pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/3 "2022-10-12T23:03:23Z")

</div>

Joe,

Thank you. I never picked that up when reading the Hugo web pages on menus  
or on other pages about nested menus.

Making these changes the main menu now has (among others) About and  
about(v). The first has the \_index.md displayed but no nested menus; the  
latter has only the nested menu names, no content in any of them. And, the  
contents of all three nested menus (as single paragraphs each) are appended  
to the Home page and a couple of others. Trying to access the various menu  
options either doesn’t work or shows a different page.

I’ll continue playing with this. I won’t post the entire site on git hub,  
it’s for my business.

Regards,

Rich

---

<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:** [October 13, 2022, 4:06pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/4 "2022-10-13T16:06:34Z")

</div>

> [@rshepard](#):
>
> The first has the \_index.md displayed but no nested menus; the  
> latter has only the nested menu names, no content in any of them. And, the  
> contents of all three nested menus (as single paragraphs each) are appended  
> to the Home page and a couple of others. Trying to access the various menu  
> options either doesn’t work or shows a different page.

I don’t understand what any of this means.

> [@rshepard](#):
>
> I won’t post the entire site on git hub

Then I think you are on your own at this point.

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 13, 2022, 4:31pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/5 "2022-10-13T16:31:17Z")

</div>

> I don’t understand what any of this means.

Joe,

I hope this clarifies my situation:

> All entries are part of one menu… main.  
> You can omit the `identifier` key if there are no duplicate `name` entries.  
> Use `pageRef` for internal links, and `url` for external links.

I did these changes (and removed the terminal ‘/’ on the pageRefs, but there  
are still issues needing resolution and my web searches haven’t found the  
fixes.

Here’s my menu tree:

```auto
>-Home
> +-_index.md
> 
+-Kudos
> +-testimonials.md
>
+-About
> +-_index.md
> >
> +-Capabilities
> > +-_index.md
> +-Education
> > +-_index.md
> >-Experience
> +-_index.md
>
+-Library
> +-_index.md
> >
> +-topic-1
> > +-topic-1.md
> +-topic-2
...
>-Blog
> +-_index.md (empty)
> >
> +-post-1.md
>
+-Contact
> +-contact.md

```

1. The Home page displays the \_index.md contents followed by part of the  
library’s \_index.md and all the nested subdirectories with a paragraph of all  
document titles.

2. The Kudos page displays correctly.

3. The About page does not display \_index.md. When I click on this menu item  
nothing happens, but when I click on the down arrow adjacent to the menu item  
the nested menus display. Clicking on a nested menu displays its contents  
followed by the Library/\_index.md and all its subdirectories.

4. The Library page does not display \_index.md. The subdirectories display as  
nested menus but the \*.md each contains produces a 404 page when I click on  
that nested menu item. (I didn’t move each \*.md to \_index.md in the Library  
directory.)

5. The Blog page does not display post-1.md, only the Library’s \_index.md and  
all submenu contents as single paragraphs rather than as lists with links to  
the static directory.

6. The contact page displays correctly.

There’s currently no style.css for the tikva theme or in /static/.

I’d appreciate a pointer to a Hugo page that teaches me what I’ve done  
incorrectly in creating all markdown contents and in the config.toml menu  
section.

Regards,

Rich

---

<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:** [October 13, 2022, 4:33pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/6 "2022-10-13T16:33:29Z")

</div>

> [@jmooring](#):
>
> Then I think you are on your own at this point.

This is impossible to troubleshoot without access to your project’s source.

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 13, 2022, 4:41pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/7 "2022-10-13T16:41:37Z")

</div>

Joe,

I’m making a copy that I’ll post to github today.

Rich

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 13, 2022, 6:16pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/8 "2022-10-13T18:16:00Z")

</div>

Joe,

I’ve not before uploaded any code to github so if there’s an issue with  
getting the site downloaded let me know and I’ll find how to fix the  
problem.

The reponsitory URL is [https://github.com/rs-aesi/company-web-site](https://github.com/rs-aesi/company-web-site).

Rich

---

<div class="post-metadata">

**Author:** ![frjo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/frjo/32/18626_2.png) [@frjo](https://discourse.gohugo.io/u/frjo)\
**Post date:** [October 13, 2022, 6:19pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/9 "2022-10-13T18:19:24Z")

</div>

The repo is empty.

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 13, 2022, 6:25pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/10 "2022-10-13T18:25:50Z")

</div>

Well, that’s not good. I wonder why. I thought I copied the local site there  
so I will find out why it didn’t work.

Thanks, Fredrick,

Rich

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 13, 2022, 6:37pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/11 "2022-10-13T18:37:14Z")

</div>

Github tells me that my authentication was withdrawn last year. I’ve not  
found how I use the command line to re-authenticate so I can push the local  
site to its github repo.

All suggestions appreciated,

Rich

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 13, 2022, 6:51pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/12 "2022-10-13T18:51:18Z")

</div>

There are now files present.

Rich

---

<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:** [October 13, 2022, 9:51pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/13 "2022-10-13T21:51:29Z")

</div>

Ugh.

1) Several of your menu entries in config.toml specify `url` rather than `pageRef`. That is why some of your menu items don’t get the `active` class when visited.

2) None of your content files have any front matter. Typically you want to have at least `title` and `date`. That way you can rely on templates’ use of `{{ .Title }}` in `head`, `body`, and `meta` elements. Then you can remove the level 1 headings from the content of your markdown.

3) Get used to using [ATX headings](https://spec.commonmark.org/0.30/#atx-headings) instead of [Setext headings](https://spec.commonmark.org/0.30/#setext-headings). It makes content creation/editing a bit easier.

4) Your archetypes directory is a bit of a mess:

```nohighlight
    archetypes/
    ├── about.md
    ├── about.md~
    ├── default.md <-- keep this, delete the others
    ├── library.md
    └── library.md~

```

5) You can delete the `config` directory and its contents. It is useless because you already have `config.toml` in the root of your project.

6) You can delete the `ebug` directory and its contents.

7) I’m not sure why you are using `_index.md` files (branch bundles) for many of your pages instead of `index.md` files (leaf bundles) or even regular pages (e.g., 'content/about/education.md`). I would expect a structure like this instead.

> **structure**
>
> ```nohighlight
> content/
> ├── about/
> │ ├── capabilities.md
> │ ├── education.md
> │ ├── experience.md
> │ └── _index.md
> ├── blog/
> │ ├── _index.md
> │ └── post-1.md
> ├── library/
> │ ├── _index.md
> │ ├── subject-1.md
> │ ├── subject-2.md
> │ └── subject-3.md
> ├── section/
> │ ├── footer/
> │ │ ├── column1.md
> │ │ ├── column2.html
> │ │ ├── column3.md
> │ │ └── index.md
> │ └── subfooter/
> │ ├── copyright.html
> │ └── index.md
> ├── contact.md
> ├── _index.md
> └── testimonials.md
> 
> ```

8) It’s not clear why you copied all of the theme files into the layouts directory in the root of your project. Only copy those files that you wish to override.

9) The Tikva theme is [minimally maintained](https://github.com/geschke/hugo-tikva/commits/master). In my view that’s a bit of a red flag.

10) Your issue with not having a clickable link for menu items with children is caused by the Bootstrap dropdown implementation\[1\]. The relevant code is [here](https://github.com/geschke/hugo-tikva/blob/master/layouts/partials/navbar_items.html). You’ll need to raise an issue (a) with the [theme author](https://github.com/geschke/hugo-tikva/issues), or (b) on another forum (e.g., [Stack Overflow](https://www.google.com/search?q=site%3Astackoverflow.com+bootstrap+dropdown+parent+clickable)). Note that the Tikva theme is using an older version of Bootstrap (v4.4.1).

11) Your issue with the wrong content being listed in certain places is due to a [single list template](https://github.com/geschke/hugo-tikva/blob/master/layouts/_default/list.html) that iterates over `.Site.Params.mainSections`. You’ll need to either (a) create list templates specific to the relevant sections, or (b) override the the existing list template, iterating over `.Pages` instead of `.Site.Params.mainSections`.

* * *

1. This is not a trivial problem to solve. This jQuery example seems to work… sort of. [javascript - Bootstrap 4 - Keeping Parent of Dropdown a clickable link - Stack Overflow](https://stackoverflow.com/a/48820496)

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 13, 2022, 10:41pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/14 "2022-10-13T22:41:28Z")

</div>

I’m not allowed to make more than 2 responses to the thread I started so I posted my response here: [https://tinyurl.com/2p92wwx2](https://tinyurl.com/2p92wwx2).

I’ll look for a new theme and start over using a better supported one.

Thanks again all,

Rich

---

<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:** [October 13, 2022, 10:52pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/15 "2022-10-13T22:52:07Z")

</div>

I’ve updated your Trust Level, so you should be able to respond freely. You may have to logout/login for the change to take effect.

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 13, 2022, 11:21pm UTC](https://discourse.gohugo.io/t/specifying-nested-menus-in-config-toml/40923/16 "2022-10-13T23:21:29Z")

</div>

Thank you, Joe.

I’ve downloaded the ‘justice’ theme and need to closely examine it to figure  
out how to use it for my needs.

Rich
