Help Needed: Modifying Menu Items in Hugo Template

Hey everyone,

I need some help with modifying the menu section of the template I’m using.

The navigation menu in my template is managed through hugo.tml and looks like this:

[menu] # Menu management
		name = 'Home'
		pageRef = '/'
		weight = 10
		name = 'About'
		pageRef = '/about'
		weight = 15
		name = 'Contact'
		pageRef = '/contact'
		weight = 20

This menu appears in two places: the footer and the top menu of the template. The issue is that the links in both locations are duplicated.

What I’m asking is how can I change the menu items that appear at the top so they aren’t duplicated?

link to theme on github


rereading the question ;-):

looks like this is intentionally by the theme

  • the footer menu is static for all pages in the site. it shows the top-level entries only
  • the header menu is generated by a partial that walks the menu tree and does something (didn’t dig in details there)

The theme you are using does not provide options to configure that. You will have to do that manually by overriding the template using standard Hugo functionality.

  1. copy the template/partial you want to change from theme folder to your layouts folder

  2. Change your local copy to match your needs

Described in the docs:

You might get a more accurate answer by asking the theme author Issues · fauzanmy/pehtheme-hugo · GitHub

as a fast approach you could

  1. copy themes\pehtheme-hugo\layouts\partials\header.html to your local layouts
  2. change the menu name from “main” to “mymenu” (line 73)
  3. define your own menu in config file
    identifier = "about"
    name       = "About"
    url        = "/about"
    weight     = 1
       identifier = "Another Entry"
       name       = "Anotherone"
       url        = "/next"
       weight     = 2
1 Like


Thanks a lot for your help! I really appreciate it.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.