Selecting a menu item when displaying a list of items based on taxonomy

Hello there,

I have the following issue and not really an idea how to solve it: I have several pages that display a list of posts based on their type. On those pages, I also display a list of taxonomy terms. When I click one of those terms, I am lead to a new page that shows me all posts tagged with that term (ex. http://localhost:1313/topics/asdf where asdf is a taxonomy term).

When I am on the first page (showing posts by type), the matching item in the menu is selected. I did that by using an for every content type. When I select a taxonomy term, the page that shows all posts related to that term does not highlight a menu item. That does make sense in a way because the taxonomy terms do not appear in the menu. I would like to highlight a menu item anyway - one of the existing ones. Is there a way to do so?


Maybe. We won’t know until we can see how your site is set up. Please read Requesting Help and share your code. :slight_smile:

Hi, I don’t really have an idea what part of the code you need and I can’t show you the entire repo because it is internal… but I added some excerpts that might help here:

That is, in the theme, the three list pages for the three taxonomy types we use.
From the config, what our default menu looks like.
From a content type which uses to have a list page appear in the menu.
And lastly, single pages that use front matter directly to appear in the menu.

In total, there are three content types (folders in the folder content): career, news and blog. All have an, the one of career is in the Gist, the others only have a title in them. Of the three taxonomy types, two apply to blog and one applies to news. So I would like to highlight the “blog” and “news” menu entries when an according taxonomy list is displayed.

I hope it is a bit clearer now what I want to do. I will provide more code if you need something specific.