I have added the following to the top of layouts/_default/baseof.html: {{ .Scratch.Set "currentPage" .Permalink}}
and then, I call my block with full scope like this: {{ block "main" . }}
and in the block, I use something like:
{{ range .Params.tags }}
{{ if in ($.Scratch.Get "currentPage") . }}
{{ $.Scratch.Set "class" "customClass" }}
{{ else }}
{{ $.Scratch.Set "class" "" }}
{{ end }}
<a class = "{{ $.Scratch.Get `class` }}">
<!-- content -->
</a>
{{ end }}
So, as you can see, I use it to add a custom class to that element and handle the rest in CSS. That’s working fine for me. You can see a working demo on my website: https://hrishikeshk.netlify.app/index.html (if you navigate to any taxonomy page, you’d see that particular taxonomy disabled).
I don’t know if there’s any better solution available, but, if there’s, I’d like to know too, because the problem in using my method is that, the URL can’t contain any of the taxonomy words.