Can't access page variables within called partial

I have a default base template as follows:

<!--Some HTML code-->
<body>
	<header>
		{{ partial "header.html" . }}
	</header>
	<main>
		{{ block "main" . }}{{ end }}
	</main>
</body>
<!-- rest of the code -->

Here, correct me if I’m wrong, the context of the template being built has been passed to the header.html partial.
When I try to access page variables inside the header partial, I get nothing. I can’t even fetch the permalink of the current template. Therefore, I know this is a context issue.
What should be done instead to achieve my goal of passing the page context through the base template?

That looks like it should work… What does the partial look like? Do you have your code somewhere we can look at?

I don’t have my code online, it’s a work in progress. The partial is a bit lengthy, here’s the part which is misbehaving:

{{ $isActive := gt (findRE "^.*\\/categories\\/$" .Permalink | len) 0 }}

The above code snippet checks if the “categories” taxonomy term page is opened or not.
Here’s where things start getting weird.
When I place this snipped inside the header.html partial. The isActive variable is set to false. However it is set to true if the snippet is place inside the taxonomy term template.
I’ve concluded through testing that the page variable calls inside the partial are failing. Calling them returns an empty value which is causing this behavior…

That line works for me inside a partial called from a baseof template.

Could you create a minimal example showing the issue?

@pointyfar Sorry for bothering you. It was a slip up from my end. I had ignored the presence of a parent range block. It was causing the context issue.