My problem relates to /research. Within that section, I like to have a research index page that has an introduction. Below the introduction should be a navigation to all sub-pages: publications (active on /research and when publications.md is active), teaching, code. Ideally, content from publications is already shown on the default research page so that users see this without click. As shown, I like to have all possible content in *.md files.
Example for /research:
Research Introduction
**Publications** Teaching Code
*Publication List*
Example for Teaching clicked:
Research Introduction
Publications **Teaching** Code
*Teaching Statement*
Basically like a tabbed nav, just with static pages.
Can someone help me figure out how to set the type:, layout: and layout files so that the functions described above would work ?
You need to rename that index.md to _index.md. As it stands, what you have defined is a leaf bundle. So the sub-pages don’t get their own permalink. So you don’t get the highlighting in the nav bar as you want. By doing that rename, you make it a branch bundle, and you can then do everything that you described.
You don’t have too assign a layout… if you have single.html and list.html in your layouts/_default/, they will apply by default e.g. your content/research/_index.md will be rendered by layouts/_default/list.html and your content/research/publications.md will be rendered by layouts/_default/single.html (given that you don’t specify the type and layout in the front-matter of those content files).
Solved that part. The only question is how I can now list the subpages in a menu? I looked at https://gohugo.io/templates/menu-templates/ but found that it changed the top header. Is there some other way?
Okay, got there. Now the only thing is: The /blog layout is a horizontal list with all the posts. However, I like the layout of the navigation (that’s actually not a nav element but a list(?)) in /research to be vertical.
{{ range .Pages }}
Hello
{{ .Render “li”}}
{{ end }}
Good thing is: It returns as much "Hello"s as there are posts in /blog and correspondingly “Hello Hello Hello” in research, as there are three sub-pages. Somehow, {{ .Render “li”}} doesn’t print the link appropriately and it should now show the nav in /blog anyways.