Create navigation from page anchors?

I’m new to Hugo, but have been playing around with it for the last couple weeks. I’m using the docDock theme and I’m trying to figure out how I can generate navigation from anchors in a markdown page instead of only being able to create navigation from separate individual markdown files. Since global search is not available across all the content it would be advantageous to allow for larger markdown files that have navigation created by anchors.


  1. Can you even create navigation from anchors in a markdown file in Hugo?
  2. Can you enabled/disable the creation of navigation in the Frontmatter for anchors (i.e. you may not want to create navigation from pages for everything?

Below is an example of a simple navigation structure where I’d like to have the file in the “Create Page” folder and then have anchors/sections within the file for sections on “Home Page”, “About images” and “Present a Slide” with the nav created form these Anchors.

Thank you for your help!!!

Are you talking about in-page navigation or global navigation?

If the former, is this what you’re looking for?

1 Like

Hey @rdwatters!

This is what I’m looking for! I also found another thread you responded to here How do I insert logic for the Table of Contents? that gave some code for a partial to do this. Are there any other guides/forums on what other files I would need to modify to make this code work?