Hello,
can we filter on authors objects ?
I can get all authors with {{#get "authors" limit="all"}}
I can also get a specific author with his ID {{#get "authors" limit="all" filter="id:1"}}
But now, I cannot filter on location for example such as {{#get "authors" limit="all" filter="location:internal"}}
According to the documentation there are several attributes but I do not understand how to use them in a filter.
Make sure your location name is correct which you used for the author’s location field. For example, if you want to get all the users who is from “London”, then use the following code,
This is what I did but unfortunately it doesn’t work that’s why i’m asking to myself if all attributes are compatible with filtering! {{#get "authors" limit="all" filter="location:test" }}
Apparently some Ghost terms (such as slugs) can be treated as literals (not quoted), but author bio/location/social fields must be compared as strings: Filtering - Ghost Developer Docs
I’m working on a similar filter based on authors’ {{facebook}} field value (which we are hijacking to group some authors into an “occasional contributors” section) and finally figured this out, thank you for your post.
All authors whose Facebook profile field includes “occasional”:
{{#get "authors" limit="all" filter="facebook:~'occasional'" as |contributors-occasional| }}
True, though I can adjust the OpenGraph fields (in our case to hide them) in our theme, which I’m already editing to make this feature work.
Good idea with the slugs, though I’d like those to stay human-readable and stable (in our case an author’s status could change over time, and I don’t want their URL to change with it).