For background, im using {{#get}} to fetch one post tagged as #primary-feature and then a second {{#get}} to fetch 4 posts tagged #secondary-feature.
I then want to show 20 latest posts but exclude the 5 that I have already shown on page.
I have nested the {{#get}} blocks so that the two feature calls wrap the “latest posts” call. However,I seem to come unstuck passing the ids into the filter.
Reading elsewhere on this forum, it seems I should be able to use [*]
:
{{#get "posts" limit="1" filter="tag:hash-primary_feature" as |primary_posts|}}
{{#get "posts" limit="4" filter="tag:hash-secondary_feature" as |secondary_posts|}}
{{#get "posts" limit="20" filter="id:-[{{primary_posts[*].id}}]" as |posts|}}
{{/get}}
{{/get}}
{{/get}}
Or even accessing the array by index:
{{#get "posts" limit="1" filter="tag:hash-primary_feature" as |primary_posts|}}
{{#get "posts" limit="4" filter="tag:hash-secondary_feature" as |secondary_posts|}}
{{#get "posts" limit="20" filter="id:-[{{primary_posts.0.id}}]" as |posts|}}
{{/get}}
{{/get}}
{{/get}}
But neither work. Certainly, the index approach works to output to the page, but not inside the filter it seems.
Is there a way to pass in a dynamic array to the filter attribute?
Error is:
Error: Query Error: unexpected character in filter at char 6
at Child.applyDefaultAndCustomFilters (/.../versions/5.32.0/node_modules/@tryghost/bookshelf-filter/lib/bookshelf-filter.js:66:23)
(id:-[])+
------^
Expecting 'NULL', 'TRUE', 'FALSE', 'NUMBER', 'NOW', 'LITERAL', 'STRING', got 'RBRACKET'
Using the latest v5.32.0