Hi, I am hosting my site on Github with Jekyll. I am struggling to assign an active class to navigation item belonging to an active category of the active page.
For example, if I navigate to Research, the Research item is highlighted in white. However, if I navigate to one of the sub-items, I want the category research still to be highlighted. But it is not.
I have added an if else statement in navigation.html to compare page category with one string from the page.url, which matches when I print them individually but for some reason the comparison does not create any boolean value it seems. The navigation.html file is in the includes folder.
Yes, I tried outputting the values. Both the values should be ‘Research’ for the main research page and any sub-page within the research category (identified by the ‘Research’ string in the page permalink). And the output strings are the same, as expected.
But when I compare them in an if statement, there seems to be no boolean output and the appropriate class is not assigned when this condition is met.