Conditional utility classes using Tailwind and Astro

I am using Tailwind and Astro.

I created this menu link component:

// MenuItem.astro

---
type Props = {
  title: string;
  path: string;
};

const { title, path } = Astro.props;
const pathname = new URL(Astro.request.url).pathname;
const currentPath = pathname.slice(1);
---

<li>
  <a
    href={path}
    class=`${currentPath === path
? 'text-red'
: 'text-blue'} relative`
    >{title}</a
  >
</li>

Is there a way to make this cleaner? To use something different then a ternary, using Astro?