How to push menu items to front and back

I want to use the lazy menus to add all sections but ALSO add items in front of the sections AND after the sections. For example:

Home - Posts - Notes - Links - About - Contact

Where the bolded items are added to the 3 sections.

The default weight for sections is 0.
I want to add -10 for Home, 10 for About and 20 for Contact.

Current behaviour is that all weight menus are sorted and then placed in front of the unweighted sections.

How can I sort the menu as I like, without needing to manually add a weight to each individual section in _index.md.

A menu item with weight 0 is unweighted. So if A has weight -10, and B has weight 0, and C has weight 10, the menu items will be ordered A, C, B.

The only way to achieve the desired result is to not use the Section Menu for Lazy Bloggers.

Instead, manually create each item in config.toml:

[[menu.main]]
  name = "Home"
  url = "/"
  weight = 10
[[menu.main]]
  name = "Posts"
  url = "/posts"
  weight = 20
[[menu.main]]
  name = "Notes"
  url = "/notes"
  weight = 30
[[menu.main]]
  name = "Links"
  url = "/links"
  weight = 40
[[menu.main]]
  name = "About"
  url = "/about"
  weight = 50
[[menu.main]]
  name = "Contact"
  url = "/contact"
  weight = 60
1 Like

Thanks. I was already afraid that I have to explicitly address the menu items. If so, I’ll do that. I have the choice of two alternatives :

  • specify menus in config like you mentioned.
  • add menu weight to _index.md for each section

I’d keep it all in one place (config.toml). That will make future modifications much simpler.

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