brigadecore / brigade

Event-driven scripting for Kubernetes
https://brigade.sh/
Apache License 2.0
2.4k stars 247 forks source link

docs: menu fixes #1841

Closed krancour closed 2 years ago

krancour commented 2 years ago

Way back in #865, it seems the sidebar was customized to be driven by data in config.toml instead of by front matter from content. As I understand it, this was done, at least in part, in order to take control of the order of items in the menu, which until then were in lexical order by title. (Although I think there may have been a simpler resolution available than a custom menu. There is a ordersectionsby = "weight" option that could have been specified in config.toml.)

Per the docs/readme.md our workaround left us in a less than optimal place:

Currently, the weights configured in the config.toml file specify ordering of each section in the main sidebar menu.

Weight values on individual documents are meant to specify ordering of pagination (previous and next navigation) within each doc's section.

This is fairly unwieldy, so if any docs/Hugo pros have knowledge on how to simplify, we'd love the contribution!

In the course of investigating options for internationalizing our docs (see #1828), I've come to believe that a sidebar menu that is driven by data in config.toml instead of by front matter from content is going to be an impediment to internationalization, so I set out to correct this duplication of weights.

This led me to the following:

  1. Undo menu customizations from #865
  2. Remove index from config.toml
  3. Ensure sidebar is sorted by weight using ordersectionsby = "weight" option in config.toml

This left me in a place where the sidebar looked exactly as it should except that in some places the name of the link in the sidebar menu used to be overridden by data that has since been removed from config.toml.

Some research revealed the existence of the predefined linkTitle front matter variable. So I:

  1. Added linkTitle to front matter in our content, as needed.
  2. Minimally customized the sidebar menu to use {{ .LinkTitle }} where it previously used {{ .Title }}.
    1. I also discovered that overrides / customizations to Hugo theme are meant to be applied by making modifications in one's own layout/ folder rather than directly overwriting files in the theme's layout/ folder, so I used this approach. See here for reference.

Where this leaves us is:

netlify[bot] commented 2 years ago

✔️ Deploy Preview for brigade-docs ready!

🔨 Explore the source changes: 2c2c9cc45f04480713e425fd03291d6cfdd4ea89

🔍 Inspect the deploy log: https://app.netlify.com/sites/brigade-docs/deploys/62158cde17223b0007230745

😎 Browse the preview: https://deploy-preview-1841--brigade-docs.netlify.app