finec-mgimo / finec-mgimo.github.io

Финэк МГИМО - программы бакалавриата и магистратуры по экономике, менеджменту, туризму и бизнес-информатике в кампусе МГИМО-Одинцово.
https://finec.mgimo.ru
MIT License
1 stars 8 forks source link

understanding types, layout and menus in Hugo #25

Closed epogrebnyak closed 3 years ago

epogrebnyak commented 3 years ago

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:

Menus:

menu:
  docs:
    parent: 'extras'
    weight: 20
epogrebnyak commented 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.

webuimaker commented 3 years ago

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 for Site.Menus, but the point when menus it actually affect layout is when Site.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 adjust menu.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 this xyz becomes Site.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, then docs is what - Site.Menus.docs variable? where does extras have to be defined? menus.toml? what is extras called? I think the meaning is subsection in docs, 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
epogrebnyak commented 3 years ago

I think the key to understanding left menus in this partial:

https://github.com/necelentano/finec-mgimo-v2/blob/df9a97040ea5f3efc632ab81d58f83f39a3b2e36/layouts/partials/sidebar/docs-menu.html#L1-L13

My takeaways:

Not clear to me: