# Navigation \> active item only partially working

**URL:** <https://discourse.gohugo.io/t/navigation-active-item-only-partially-working/19472>\
**Category:** support\
**Created:** [July 4, 2019, 12:46pm UTC](https://discourse.gohugo.io/t/navigation-active-item-only-partially-working/19472 "2019-07-04T12:46:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [July 4, 2019, 12:46pm UTC](https://discourse.gohugo.io/t/navigation-active-item-only-partially-working/19472/1 "2019-07-04T12:46:01Z")

</div>

I don’t get my menu design to work. The menu is ok, but marking the currently active item is a bit hard.

I have the following structure in my content:

```auto
content/
content/page/*
content/post/
content/post/2019/01
content/post/2019/02
...
content/sitewide/*
content/tags/*

```

Simply said I would like to mark a menu item active if it’s the current page (inside of the page folder) or if the menu item is the archive (either list pages for posts, taxonomies or single items) or we see a post (one of the items inside of content/post).

I would have expected the following piece to work:

```auto
        {{ $currentPage := . }}
        {{ range .Site.Menus.main }}
          <li class="nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) (and (eq $currentPage.Type "post") (eq .Identifier "archiv" )) }} active{{end}}">
            <a href="{{.URL}}"{{if eq .Page nil }} target="_blank" rel="noopener noreferrer"{{ end }} class="nav-link">
              <span class="icon larger light" aria-hidden="true">
                {{ partialCached (print .Pre) .}} 
              </span>&nbsp;
              {{ .Name }}
            </a>
          </li>
        {{ end }}

```

It doesn’t though. The archive link is ALWAYS marked active. (The menu entry is in page frontmatter and it’s identifier is “archiv” - German ;] ).

What would be the correct way to use a whole section as an indicator? I tried `.Section`, but that makes ALL links in the nav active.

The front matter in the page-folder explicitly marks them as `type: page`.

The repo is here: [https://github.com/davidsneighbour/samui-samui.de](https://github.com/davidsneighbour/samui-samui.de)

---

<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:** [July 4, 2019, 1:47pm UTC](https://discourse.gohugo.io/t/navigation-active-item-only-partially-working/19472/2 "2019-07-04T13:47:40Z")

</div>

This may help: [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:** ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)\
**Post date:** [July 4, 2019, 2:16pm UTC](https://discourse.gohugo.io/t/navigation-active-item-only-partially-working/19472/3 "2019-07-04T14:16:29Z")

</div>

I’m not quite entirely sure yet, but it may be your use of `partialCached` to reference the header (therefore navbar, therefore menu)?

As a test: printing out `{{.}}` from within the nav partial vs from the baseof and checking the results in your kontakt page sometimes gives me different results. And depending on which page gets printed from inside the nav partial, different menu items get set to `active`.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [July 4, 2019, 2:21pm UTC](https://discourse.gohugo.io/t/navigation-active-item-only-partially-working/19472/4 "2019-07-04T14:21:37Z")

</div>

Oh. My. God. That would explain about 10 of my current problems. And I don’t know how the cached got there. Thanks for that 🙂 I will go hide and bow my head in shame for about an hour or so.
