balaramadurai / hugo-travelify-theme

Port of Aigars Silkalns's Wordpress theme Travelify to Hugo. Demo -
http://balaramadurai.github.io
MIT License
39 stars 27 forks source link

Nested Menus #8

Closed savem14 closed 6 years ago

savem14 commented 6 years ago

Unable to view nested menu items when defining in topmatter.

The drop-down menu works when defined in config.toml as follows:

[[menu.main]] name = "About" url = "/About/about/" identifier = "abt" weight = 10

[[menu.main]] name = "Management" url = "/About/Management" parent = "abt"

When defining in topmatter for the "Management" page (using the same code and toml format) get the following error:

ERROR 2018/05/02 11:21:30 unable to process menus for "Management": unable to cast []map[string]interface {}{map[string]interface {}{"url":"/About/Management", "parent":"abt", "name":"Management"}} of type []map[string]interface {} to map[string]interface{}

balaramadurai commented 6 years ago

Hi Evan, Thanks for trying out this theme. I am sorry that you faced this error. Here is the solution:

Try this instead of what you had tried out:

[[menu.main]]
name = "Management"
url = "/About/Management"
parent = "About"

The nested menus use the name instead of the identifier. I used the modules in Hugo for this. May be there is a way to use identifier as well, but I haven't done this in this theme.

Thanks again, please do let me know if this works for you

savem14 commented 6 years ago

Thank you so much for the quick response! I got the menu system working using your suggestion.

However, I am now seeing a "Posts" article listed under my most recently posted article. I suspect there is a way to suppress this from occurring but I cannot see where you may have done that in the example site.

Do you know of a quick way to suppress this from happening?

balaramadurai commented 6 years ago

@savem14, thank you for your message. I have fixed this error in #15. If you update your repo, you'll see that "Posts" post vanish...