I used JavaScript for this, in case someone looks for the same query I was searching and jumps on this thread:
<script>
(function() {
const links = document.getElementsByTagName('a')
const currentUrl = location.href
for (const link of links) {
if (link.href === currentUrl) {
link.classList.add('active')
}
}
}())
</script>