This page has many h2 elements with id tags. I would like the to use either as submenu items in the menu on the left. I’ve tried some options, but somehow I’m not grasping how/if this can be done.
I guess I want the TOC headers to be part of the menu. This is a very common thing, especially with documentation sites. Check http://getbootstrap.com/css/#code-user-input for instance. The various TOC headers are also part of the right hand side menu. Could this be done?
@dhersam now I’m confused ;o) I don’t have a theme or want to add a theme. I’d like to know if I can add the contents of the TOC object (the TOC headers) into a menu.
@bep Ok, let me re-explain my original question. I would like to have headers show up in a menu.
I have a page in markdown as follows:
h1 header
bla bla
h2 header
bla bla
I can use the TOC functionality in Hugo as noted by @spf13 in http://gohugo.io/extras/toc/ to generate a table of contents somewhere on that page. That’s all clear and works great!
What I want is to have the entries in the table of contents show up in a side menu as menu items, exactly like many documentation sites, like http://getbootstrap.com/css/#code-user-input
@bep Nah, I’m afraid the MenuEntry struct does not allow this, which kinda makes sense looking at the Hugo source code. If you embed {{ .TableOfContents }} in any way or form inside a Menu, Hugo throws errors:
ERROR: 2015/07/03 template: partials/side_nav.html:20:27: executing "partials/side_nav.html" at <.TableOfContents>: TableOfContents is not a field of struct type *hugolib.MenuEntry in partials/side_nav.html
Note: my side_nav.html is a separate partial used to render the menu you see on the left at http://vamp.io/documentation/