{{../url}} returns undefined?

I have a sidebar where I show all posts using foreach.
Is it possible to highlight the post that is currently open?
I created a custom helper but I cannot seem to get the parent url.
Using …/url returns undefined.
the current setup looks something like this:

{{#post}}
  {{title}}
  {{content}}
  
 {{#get "posts" filter="tags:blog" order="published_at desc" as |pt|}}
  {{#foreach pt }}
  {{#isSubstring url (../url)}}
  <a class="bold" href="{{url}}">{{title}}</a>
  {{else}}
  <a class="regular" href="{{url}}">{{title}}</a>
{{/foreach}}
{{/get}}

You can use the link_class helper with url variable.

{{#get "posts" filter="tags:blog" order="published_at desc" as |pt|}}
  {{#foreach pt }}
    <a class="link-class {{link_class for=url activeClass="bold"}}" href="{{url}}">{{title}}</a>
  {{/foreach}}
{{/get}}

REF:

1 Like

Well, this definitely solves that! Thanks
But I would still like to understand why the {{…/url}} does not work?

1 Like