Use #has to check current URL?

Hi guys, I am currently running the latest ghost version locally to set up a documentation for my company.
I was trying add classes in a menu depending on what page I am on.
Ideally I could do something like {{#has url=current_url}} nav-expanded {{/has}}.
I saw that this is possible using {{navigation}} but I am actually iterating over tags while doing this and want to keep my navigation as is.
E.g.: the “Introduction” item would be expanded if the url is “/docs/intro/”.
One work-around could be to use secondary navigation but it seems a lot more complicated than it needs to be.

The post slug will always be unique, so you could use that, right?

That’s what I was hoping but I don’t seem to be able to do the evaluation in the #has tag.
If the slug=“intro” and url="/docs/intro/" - how would you compare that? is there a way to split a string in handlebars?

The page with the url /docs/intro will use the content with the slug intro, so you can use the has helper to just compare slugs:

{{#has slug="intro"}}
{{!-- You are on the `/docs/intro` page. If this doesn't work, that means the `docs/intro` page is using has a different slug, or there's something wrong with your context --}}

This would work for all pages that do have a slug. But when I am just on the index page this once again doesn’t work. Is there any way I can change the available context?

Quick addition to what I just wrote:
Even {{#has url="/docs/intro/"}} does not seem to evaluate to true.
I am very confused about which context is available where. Shouldn’t the {{url}} be available from anywhere if it is index, page, or post?

The reason it doesn’t evaluate to true is because the has helper doesn’t support querying against the URL:

If you’re on an index page, the is helper is also useful. However, I’m not entirely sure if you’re able to see what collection you’re on. You can also use client-side enhancement which lets you use whatever js scripting your want to use