Here is my current solution.
It’s ugly and stupid, but it works
# label: "Blog Post Tag Filter"
# $blog_id: "{{ blog.id }}"
# $tag0: {{ (request.query|split('&')|select('containing', 'tag' )|join('&')|replace('tag=', '')|split('&'))[0] || [] }}
# $tag1: {{ (request.query|split('&')|select('containing', 'tag' )|join('&')|replace('tag=', '')|split('&'))[1] || [] }}
# $tag2: {{ (request.query|split('&')|select('containing', 'tag' )|join('&')|replace('tag=', '')|split('&'))[2] || [] }}
# $tag3: {{ (request.query|split('&')|select('containing', 'tag' )|join('&')|replace('tag=', '')|split('&'))[3] || [] }}
# $tag4: {{ (request.query|split('&')|select('containing', 'tag' )|join('&')|replace('tag=', '')|split('&'))[4] || [] }}
# $tag5: {{ (request.query|split('&')|select('containing', 'tag' )|join('&')|replace('tag=', '')|split('&'))[5] || [] }}
# $tag6: {{ (request.query|split('&')|select('containing', 'tag' )|join('&')|replace('tag=', '')|split('&'))[6] || [] }}
# $tag7: {{ (request.query|split('&')|select('containing', 'tag' )|join('&')|replace('tag=', '')|split('&'))[7] || [] }}
# $tag8: {{ (request.query|split('&')|select('containing', 'tag' )|join('&')|replace('tag=', '')|split('&'))[8] || [] }}
# $tag9: {{ (request.query|split('&')|select('containing', 'tag' )|join('&')|replace('tag=', '')|split('&'))[9] || [] }}
query getPostByTagFilter($blog_id: String!, $tag0: String, $tag1: String, $tag2: String, $tag3: String, $tag4: String, $tag5: String, $tag6: String, $tag7: String, $tag8: String, $tag9: String) {
BLOG {
blogPosts: post_collection(
filter: {
content_group_id__eq: $blog_id,
state__eq: "PUBLISHED",
post_tag_slug__in: [$tag0, $tag1, $tag2, $tag3, $tag4, $tag5, $tag6, $tag7, $tag8, $tag9]
},
orderBy: publish_date__desc
) {
items {
tag_ids
blog_tags {
name
id
}
name
post_summary
url
featured_image
featured_image_alt_text,
publish_date
state
widgets
}
offset
limit
total
}
}
}
If 10 Filters by tag aren’t enough, just add more. They are all optional