如何使用Hugo在.md文件中的内容文件夹中创建另一个菜单?
我尝试在另一个页面上创建与我的主菜单不同的菜单,我在config.toml中写下代码,但我不知道如何放入.md文件中。 config.toml文件中有我的代码
[menu]
#Main Menu
[[menu.main]]
name = "Inicio"
identifier = "menu.Inicio"
url = "/"
weight = 1
[[menu.main]]
name = "Nosotros"
url = "/about-us"
weight = 2
parent = "menu.Inicio
I trying to create a different menu than my main menu on another page, i write my code in the config.toml but i have no idea how can i put in my .md files.there is my code in the config.toml file
[menu]
#Main Menu
[[menu.main]]
name = "Inicio"
identifier = "menu.Inicio"
url = "/"
weight = 1
[[menu.main]]
name = "Nosotros"
url = "/about-us"
weight = 2
parent = "menu.Inicio
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
选项一:
在您的网站的
config.toml
文件中,您可以声明多个菜单。 不需要这个
雨果 菜单。在FrontMatter中,例如
content/posts/first page.md
:对于多个菜单,添加另一个菜单条目:
选项两个:
请勿在内容中创建菜单条目文件。相反,您可以将链接添加到网站
config.toml
文件中的菜单或菜单。Option one:
In your site's
config.toml
file, you can declare multiple menus. Hugo doesn't require this, but it's helpful to list them in one place:menu = ['main', 'pasto']
Then in the content pages you can assign that content item to one or multiple menus. In the frontmatter, for example
content/posts/first-page.md
:For multiple menus, add another menu entry:
Option two:
Do not create menu entries in the content files. Instead, you can add links to the menu or menus in the site's
config.toml
file.