mheland
February 12, 2025, 11:36am
1
I am unable to get the #get “tags” to filter on slug. I don’t want all tags, just those starting with “myprefix-”
This does not…
{{#get "tags" filter="slug:[myprefix-]" limit="all" include="count.posts" order="count.posts desc"}}
nor this filter="slug:[myprefix*]"
or this {{#get "tags" filter="slug:^myprefix-"
Also tried pulling all tags and then looping them out with {{#has slug=jjs }}
Anyone who has successfully filtered tags on slug and can share any insights?
tx /m
1 Like
You need slug:~^‘jjs’
UPDATE: Added single quotes above. See later post for full example.
2 Likes
mheland
February 12, 2025, 12:29pm
3
A tilde! If this works I’ll send a case of beer…
tx /m
2 Likes
Tea, please. :) And if what I typed doesn’t work, let me know, because I’ve definitely used it before and can find an example if needed.
1 Like
Update: Oops. Missing some single quotes. This works (just tested):
{{#get "tags" filter="slug:~^'fred'" as |fred|}}
{{#foreach fred}}
<p>Got a tag named {{name}}</p>
{{/foreach}}
{{/get}}
2 Likes
mheland
February 12, 2025, 8:47pm
6
And single quotes. Really?!?
Works. Earl Gray, Rooibos…let me know your preference and DM me your address.
Thank you.
/m
2 Likes
Single quotes are never wrong, but sometimes optional. Honestly, I’m not 100% sure why they’re required here - I’ll guess that the parser gets confused by something other than : for the operator.
That’s very kind of you, I never say no to tea. Unless it’s Early Gray or Rooibos. :)