Closed epogrebnyak closed 3 years ago
@necelentano - the above summarises my findings about Hugo menus, please add if you have some quastion related to how hugo works with menus, types and layouts - you can write in Russian and I can translate.
Hope to get @webuimaker to answer and comment in this thread.
Menus:
- menus seem like building a tree for
Site.Menus
- is it correct that menu.toml and front matter are used to create some structure forSite.Menus
, but the point when menus it actually affect layout is whenSite.Menus
in layout and partials?
[yes ots using .toml to render menu and also used front matter like docs left side menu ]
- I was surprised by behavior when some menu was not listed in
menu.toml
, but if it appeared in front matter - we still had it in rendered page, so it took time to adjustmenu.toml
is not the only place that controls menu-building.
[yes, hugo have option to render menu as per the frontmatter under content like docs - > left sidebar menu]
- in Doks theme there are four types of menus: main, docs, footer, social. I wonder where this is defined? I assume main, docs, footer, social become effectful when used in layouts? there is not other mechanism
[its also define under config-> menu.toml]
- is this true in
menus.toml
we can have[[xyz]]
and then thisxyz
becomesSite.Menus.xyz
, and when it is used in some layout (or partial), this starts to affect the rendering result
[yes]
- is defining a new menu in front matter equally valid as defining it in menus.toml?
[yes likr [[]socail]]
- what does this structure mean in front ?
menu
is front mater tag, thendocs
is what -Site.Menus.docs
variable? where doesextras
have to be defined? menus.toml? what isextras
called? I think the meaning is subsection indocs
, but maybe there is nothter term.
[it's used for render page menu and as per this extras is the parent ]
menu: docs: parent: 'extras' weight: 20
I think the key to understanding left menus in this partial:
My takeaways:
.Site.Menus.docs
variable doks
embedded in assets/scss a lot, so the name is not really replacableNot clear to me:
Our situatoin: we started working with project structure based on https://github.com/h-enk/doks/tree/master/content and soon realised if we are not putting new markdown files in docs folder we get wrong and distorted layout.
So our questions were:
Our understanding so far:
Types:
content/<type1>/something.md
folder structurearchetypes
do not control whet types are availaable, they are helper templateslayout/<type1>
folder, Hugo will use the layout fromt that folder to rendersomething.md
layout/_default
- we have not changed it, so it may be responsible for rotten layoutMenus:
menus seem like building a tree for
Site.Menus
- is it correct that menu.toml and front matter are used to create some structure forSite.Menus
, but the point when menus it actually affect layout is whenSite.Menus
in layout and partials?I was surprised by behavior when some menu was not listed in
menu.toml
, but if it appeared in front matter - we still had it in rendered page, so it took time to adjustmenu.toml
is not the only place that controls menu-building.in Doks theme there are four types of menus: main, docs, footer, social. I wonder where this is defined? I assume main, docs, footer, social become effectful when used in layouts? there is not other mechanism
is this true in
menus.toml
we can have[[xyz]]
and then thisxyz
becomesSite.Menus.xyz
, and when it is used in some layout (or partial), this starts to affect the rendering resultis defining a new menu in front matter equally valid as defining it in menus.toml?
what does this structure mean in front ?
menu
is front mater tag, thendocs
is what -Site.Menus.docs
variable? where doesextras
have to be defined? menus.toml? what isextras
called? I think the meaning is subsection indocs
, but maybe there is nothter term.