Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top Nav Menu showing wrong item selected #31

Open
lschierer opened this issue Jun 4, 2023 · 0 comments
Open

Top Nav Menu showing wrong item selected #31

lschierer opened this issue Jun 4, 2023 · 0 comments

Comments

@lschierer
Copy link
Contributor

Expected Behaviour

The correct item will be selected

Actual Behaviour

the first item is always selected

Reproduce Scenario (including but not limited to)

set up a site using this theme with the file
config/_default/menus/menus.en.tolm
and content

[[main]]
  name = "Generals"
  url = "/generals"
  weight = 10

[[main]]
  name = "Monsters"
  url = "/monsters"
  weight = 20

[[main]]
  name = "SvS"
  url = "/svs"
  weight = 30

[[main]]
  name = "Reference"
  url = "/reference"
  weight = 100

Steps to Reproduce

  1. navigate to any section
  2. observe that Generals is selected
  3. navigate to any other section
  4. observe that Generals is still selected

Platform and Version

Sample Code that illustrates the problem

the problem is in navbar.html

{{ range .Site.Menus.main }}

{{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) }}
{{ with .Page }}
{{ $active = or $active ( $.IsDescendant .)  }}

the first or will always be true if I define a main menu at all. Once that is true, the second or will be testing

true or $.IsDecendant

which of course is always true as well.

I'm still trying to think up the proper set of tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant