Is that possible to filter by attribute from outside the “content”-object?
Documentation says that
Every field in the
content field can be used as the
ATTRIBUTE key in your
But what about the fields outside the “content”-object? Such as “lang”, “slug”, “id”, “tag_list”?
For example, I want to create a query where “tag_list”-array has on of the given values OR “category”-field equals to certain value. (“category”-field is my custom field within “content”).
I haven`t found a solution for that yet.
Any help apprecated.
filter_query parameter you can search only in the content object. When you need to filter for the published_at field you can use for example the
published_at_lt or in the case of the first_published_at field with
It is possible to use the
by_slugsparameter and wildcards, Here are examples from the documentation:
The language selection is being done by defining (field-level translation - Internationalization - Storyblok) the local as the value for the
Filtering for tags from the tag list is possible with the
with_tag parameter but using the
filter_query parameter is much more flexible because you can use a multi-option field and provide a datasource as the source with the selectable tags which can then be filtered for (Storyblok API Documentation)
Thanks for help @Hannes !
Yes, I agree - “filter_query” is way more flexible than “with_tag”-parameter, especially in my case. But its still not clear for me, is that possible to filter by tags in some way within “filter_query” instead of using “with_tag”-parameter?
filter_query you can filter only inside of the content type. The
"tag_list" isn’t part of the content type so you won’t be able to use
filter_query on those tags.