Books and Hugo web pages have the site’s menu defined in the root directory’s config.toml. I’m trying to use the Justice theme for my revised company website. This theme puts menu information on each content page’s front matter; for example,
What I’ve not found is how to assemble these specifications into a menu bar at the top of each page (and as a hamburber menu on small screens). Greping for ‘menu’ in the theme directory finds nothing.
How do I create the menu from these front matter contents? Or, do I remove them and put the menu in config.toml?
Ah! Your layouts/_default/baseof.html template includes header.html, which does not render any menus. If you change that to site-header.html, you’ll see the main menu rendered.
Alternatively, you can copy the menu template bits from site-header.html into your header.html.
And you’ve probably already corrected this, but there was a missing colon on line 4 of content/_index.md that was preventing the site from building.
Ah! Your layouts/_default/baseof.html template includes header.html,
which does not render any menus. If you change that to site-header.html,
you’ll see the main menu rendered.
Tim,
Darn! I missed that.
And you’ve probably already corrected this, but there was a missing colon
on line 4 of content/_index.md that was preventing the site from
building.
Missed that one, too.
Now the menu includes my content/ as well as that of theme/justice/content.
I had the impression that any file external to the theme’s directory was
used and that same named file in the theme’s directories was ignored. Should
I remove theme/justice/content/ or is there a way to tell Hugo to ignore it?
Thanks for helping me learn Hugo. I need all the help I can get.
A good question! I actually have zero experience with using themes, so hopefully someone else can answer that.
My instinct would be to use the theme as an example – copy and customize the parts you want, and delete the rest. On the other hand, there’s likely a very good reason themes exist as they do, so it we’d probably both be better off to learn what that is.
A good question! I actually have zero experience with using themes, so
hopefully someone else can answer that.
Tim,
How interesting.
My instinct would be to use the theme as an example – copy and customize
the parts you want, and delete the rest. On the other hand, there’s likely
a very good reason themes exist as they do, so it we’d probably both be
better off to learn what that is.
You’re welcome to join me in learning how to use themes to get the content
and presentation we want.
I’ve cleaned most of the menu but there are still issues.