Getting members-only post with {{#get}}

Is there any way to include members-only posts in the results of {{#get}} query? For example, I’m getting featured posts with this query, but the members-only posts have been excluded.

{{#get "posts" filter="featured:true" limit="all" include="tags" visibility="all" as |featured|}}

Hello @minimaluminium!

Try it:

{{#get "posts" limit="all" filter="featured:true" include="tags"}}
{{#foreach posts visibility="members"}}
...
{{/foreach}}
{{/get}}
1 Like

That was it. The visibilty parameter should’ve actually been used in the loop. Thanks so much!

No problem :slight_smile:

1 Like

Can the opposite of this be done with - include all posts EXCEPT members posts?
Thanks!

Using #foreach helper without visibility parameter should do the trick.

{{#foreach posts}}
...
{{/foreach}}

This link also might help.

https://ghost.org/docs/members/content-visibility/#visibility-in-posts

1 Like