# IsMenuCurrent doesn't work for me

**URL:** <https://discourse.gohugo.io/t/ismenucurrent-doesnt-work-for-me/10607>\
**Category:** support\
**Created:** [February 17, 2018, 5:19pm UTC](https://discourse.gohugo.io/t/ismenucurrent-doesnt-work-for-me/10607 "2018-02-17T17:19:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marek\_Lichtner](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/marek_lichtner/32/5281_2.png) [@Marek\_Lichtner](https://discourse.gohugo.io/u/Marek_Lichtner)\
**Post date:** [February 17, 2018, 5:19pm UTC](https://discourse.gohugo.io/t/ismenucurrent-doesnt-work-for-me/10607/1 "2018-02-17T17:19:30Z")

</div>

Hi guys, I tried to highlight current menu and it doesn’t work for me. I checked docs and forum and I did not find answer.

1. I made fresh clean hugo page (version 0.36.1)
2. I created a.md, b.md and c.md pages
3. This is my code:

config.toml

```auto
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"

[[menu.main]]
  name = "Home"
  identifier = "home"
  url = "/"
  weight = 10
[[menu.main]]
  name = "A"
  identifier = "a"
  url = "/a/"
  weight = 20
[[menu.main]]
  name = "B"
  identifier = "b"
  url = "/b/"
  weight = 30
[[menu.main]]
  name = "C"
  identifier = "c"
  url = "/c/"
  weight = 40

```

single html

```auto
<!doctype html>
<html lang="en">
<head>
  <title>test</title>
</head>
<body>
  <h1>{{.Title}}</h1>
  <div>{{.Content}}</div>

  {{ $currentPage := . }}
  <ul>
    {{ range .Site.Menus.main }}
      <li>
        {{ .Name }}
        | IsMenuCurrent = {{ $currentPage.IsMenuCurrent "main" . }} |
        | $currentPage = {{ $currentPage }}
        | menuItem = {{ . }}
      </li>
    {{ end }}
  </ul>
</body>
</html>

```

and result for menu B is:

```auto
B
bbb

Home | IsMenuCurrent = false | | $currentPage = Page("B") | menuItem = {/ <nil> Home main home 10 []}
A | IsMenuCurrent = false | | $currentPage = Page("B") | menuItem = {/a/ <nil> A main a 20 []}
B | IsMenuCurrent = false | | $currentPage = Page("B") | menuItem = {/b/ <nil> B main b 30 []}
C | IsMenuCurrent = false | | $currentPage = Page("B") | menuItem = {/c/ <nil> C main c 40 []}

```

B should be current menu but is not.

Do you have any idea where is a problem?  
Thanks.

---

<div class="post-metadata">

**Author:** ![Raymond\_Camden](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/raymond_camden/32/1076_2.png) [@Raymond\_Camden](https://discourse.gohugo.io/u/Raymond_Camden)\
**Post date:** [April 9, 2018, 4:19pm UTC](https://discourse.gohugo.io/t/ismenucurrent-doesnt-work-for-me/10607/2 "2018-04-09T16:19:58Z")

</div>

Were you able to find a solution? I’m hitting the same thing.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/totallyinformation/32/5668_2.png) [@TotallyInformation](https://discourse.gohugo.io/u/TotallyInformation)\
**Post date:** [April 11, 2018, 9:27am UTC](https://discourse.gohugo.io/t/ismenucurrent-doesnt-work-for-me/10607/3 "2018-04-11T09:27:38Z")

</div>

Here’s how I do it in my main menu:

```
<div class="navbar-item has-dropdown is-hoverable {{ if $currentPage.HasMenuCurrent "main" . }}has-text-weight-bold{{ end }}" aria-haspopup="true">

```

The only minor problem with that is if you are using drop-down menus as a page with a sub-menu will also have the main menu item as well so everything is bold. I’ll get round to improving it one day but as I’ve only just started to migrate from WordPress, I have more important things to fix first.
