Receive the full description of a category in a theme

If the goal is to conditionally render the links on specific category pages, then I recommend taking a step back and trying a different approach.

Let’s say you have a setting like this

target_category, link_text, link_title, link_href

You can then do something like this.

api.addNavigationBarItem({
  displayName: text, // link text
  name: title, // link title
  href: href, // link href
  customFilter: category => {
    return (
      category && category.name.toLowerCase() === TARGET_CATEGORY.toLowerCase() // target category
    );
  }
});

The important bit here is the customFilter because I think that’s what you’re after.

If you have multiple links, you’ll need to wrap that in a forEach