# Won't pickup .HasMenuCurrent or .IsMenuCurrent

**URL:** <https://discourse.gohugo.io/t/wont-pickup-hasmenucurrent-or-ismenucurrent/18379>\
**Category:** support\
**Created:** [April 27, 2019, 2:37pm UTC](https://discourse.gohugo.io/t/wont-pickup-hasmenucurrent-or-ismenucurrent/18379 "2019-04-27T14:37:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![flips](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/flips/32/7296_2.png) [@flips](https://discourse.gohugo.io/u/flips)\
**Post date:** [April 27, 2019, 2:37pm UTC](https://discourse.gohugo.io/t/wont-pickup-hasmenucurrent-or-ismenucurrent/18379/1 "2019-04-27T14:37:25Z")

</div>

Trying to get Hugo to mark active menu entry using the example from [https://gohugo.io/templates/menu-templates/](https://gohugo.io/templates/menu-templates/)  
But I couldn’t get it working. It seems that `$currentPage.HasMenuCurrent` and `$currentPage.IsMenuCurrent` are never true … 🤔

I tested also by adding (to my `nav.html` partial):

```auto
    {{ $currentPage := . }}
    {{ range .Site.Menus.main }}
      {{ if $currentPage.HasMenuCurrent "main" . }}
        HasActive
      {{ end }}
      {{ if $currentPage.IsMenuCurrent "main" . }}
        IsActive
      {{ end }}
...

```

… but no `IsActive` or `HasActive` shows up no matter …

**Any hints on what I can do to check?**

Can it be related to multilingual setup?  
I’m defining my menu in `config.toml` using stuff like `[[languages.no.menu.main]]` and `[[languages.en.menu.main]]`.

I bet I’m just missing something really obvious … 😅

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [April 27, 2019, 4:04pm UTC](https://discourse.gohugo.io/t/wont-pickup-hasmenucurrent-or-ismenucurrent/18379/2 "2019-04-27T16:04:07Z")

</div>

> [@flips](#):
>
> **Any hints on what I can do to check?**
> 
> Can it be related to multilingual setup?

Create a small project without multilingual, and with only a few pages of content, and see if your menu works.

---

<div class="post-metadata">

**Author:** ![flips](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/flips/32/7296_2.png) [@flips](https://discourse.gohugo.io/u/flips)\
**Post date:** [April 27, 2019, 4:55pm UTC](https://discourse.gohugo.io/t/wont-pickup-hasmenucurrent-or-ismenucurrent/18379/3 "2019-04-27T16:55:47Z")

</div>

Tried real quick on an earlier pre-multilingual version of the same site. Did not work here either. 🤔  
(“My” menu is copied directly from the Hugo doc example …)

Can I turn on debugging and get more info from the build, maybe?

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [April 27, 2019, 5:29pm UTC](https://discourse.gohugo.io/t/wont-pickup-hasmenucurrent-or-ismenucurrent/18379/4 "2019-04-27T17:29:21Z")

</div>

This may be helpful: [Another way to make a menu item active](https://discourse.gohugo.io/t/another-way-to-make-a-menu-item-active/17029)

---

<div class="post-metadata">

**Author:** ![flips](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/flips/32/7296_2.png) [@flips](https://discourse.gohugo.io/u/flips)\
**Post date:** [April 27, 2019, 6:36pm UTC](https://discourse.gohugo.io/t/wont-pickup-hasmenucurrent-or-ismenucurrent/18379/5 "2019-04-27T18:36:06Z")

</div>

Thank you!

It seems that if I move the menu definition away from `config.toml` and into the front matter for each content file, the tests work!

And adding `sectionPagesMenu = "main"` to get the sections automatically.  
(Can I hide a section then I have this enabled?) 😄

---

<div class="post-metadata">

**Author:** ![flips](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/flips/32/7296_2.png) [@flips](https://discourse.gohugo.io/u/flips)\
**Post date:** [April 28, 2019, 12:10am UTC](https://discourse.gohugo.io/t/wont-pickup-hasmenucurrent-or-ismenucurrent/18379/6 "2019-04-28T00:10:10Z")

</div>

Interestingly, I seem to only get `IsActive` for the sections themselves when I use `sectionPagesMenu`.

If I don’t use `sectionPagesMenu` and instead define section menu entries in `_index.md` for each section, then the `IsActive` method return true only for sub pages of each section, not for the section itself … I guess I’m still confused. 😕🙂

Can I somehow use `sectionPagesMenu` and then override the name? It seems to use `.Title` … 🤔
