"active" class not working on nav menu in bootie docs theme (edited post)

I’m using the bootie docs theme. After spending hours trying to get the active class to work on the nav links for my own site, I installed a brand new hugo site, downloaded the bootie docs theme, added a new page call “about” and a menu item for that page in config.toml, all according to the bootie docs documentation.

With that minimal site and NO changes to the theme, the “About” link in the menu is NOT highlighted as it is on the Bootie Docs demo site.

An inspection of the link on the demo site shows this:

  • About
  • An inspection of the link on the new site shows this:

  • About
  • The “active” class is NOT being recognized on the minimal site I created…

    The menu item in the config file is:

    [[params.mainMenu]]
    name = "About"
    link = “about/”

    The code from the partial/header.html file (unedited from the theme download) is:

  • Home
  • {{ $url := .Permalink }} {{ with .Site.Params.mainMenu }} {{ range $menu := . }} {{ $itemUrl := printf "%s/%s" $baseUrl $menu.link }}
  • {{ $menu.name }}
  • There appears to be a bug or something missing in the downloaded theme that exists in the code for the demo site.

    Can someone please point me to the theme creator to ask about or report this problem?

    Or if anyone knows what the problem is, please let me know.

    Thank you!
    Kat

    I had the same problem.
    I used

    3 x ` instead of 1

    I’m afraid I don’t understand your reply. Can you please elaborate on what you did and did it resolve the “active” class problem?

    To show your Code correct you have to wrap the Code-fragments in 3 BackTicks --> Your Code

    Understood, thank you!

    I was hoping you had a solution to the actual problem, which appears to be a bug. I’ve emailed the theme developer.

    Hello,

    I’m the theme developer.
    Thank you for your reporting.

    I’ll take a look into this problem.

    Delighted to hear that! Please give an estimate for when you’ll be ready for us to test your solution.

    Hello,

    Thank you for all users of this theme.

    I apologize for my late working on this issue.

    After a short working, I found this is a known issue for local development.
    Because Hugo appends / to .Site.BaseURL for local server, handling active link doesn’t work.

    But once you build and publish your site for configured domain, they will be treated well.
    At least, my several sites using bootie-docs are working well.

    For future work, I plan to switch to Hugo’s built-in Menu system: https://gohugo.io/extras/menus/ from bootie-docs’ current implementation.

    The tracking issue is https://github.com/key-amb/hugo-theme-bootie-docs/issues/23

    Thank you.

    Hello again,

    For future work, I plan to switch to Hugo’s built-in Menu system – from bootie-docs’ current implementation.

    I just release this as Bootie Docs v1.3 – Fix #23 / Switch to Hugo's built-in Menu System by key-amb · Pull Request #26 · progrhyme/hugo-theme-bootie-docs · GitHub .

    After this change, “active” class works well both for local development and for published site.
    I think this will fix your problems.

    Be carefull that you need to change your config.toml (or config.yaml) after updating Bootie Docs:

    i.e) [[params.mainMenu]] => [[menu.main]]

    I also updated the documentation: http://key-amb.github.io/bootie-docs-demo/usage/

    Thanks,