Defining a variant of a cached partial

My navigation is in the format below. How do I define a variant of a cached partial {{ partial "nav.html" . }}? :slightly_smiling_face:

  {{ $currentPage := . }}{{ range site.Menus.main }}
 {{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}<li><a href="{{ .URL | absURL }}"  class="active" aria-current="page">{{ .Name }}</a></li>
    {{ else }}<li><a href="{{ .URL | absURL }}">{{ .Name }}</a></li>{{ end }}
	{{ end }}

I tried adding . .IsMenuCurrent to the partial but it triggered an error.

Assuming that each page has itโ€™s individual navigation then the dot would do it.

{{ partialCached "path" . . }}

First dot hands over the content of the page, the second one makes it cached only for the same page.

@davidsneighbour The navigation is in the baseof.html file.

Edit: So far, using the second dot seems to work for the few files I have tested. Marked your answer as the solution unless something else shows up.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.