When a user isn’t logged in, post titles are still displaying on the homepage and if they know the name of a tag. I’d like to hide the post titles unless a member is signed in and is part of a membership tier that can view the post.
I tried modifying the theme files to add the access variable, but that doesn’t seem to work. Now nobody can see the post titles!
Here’s a snippet of code from the modified tag page -
{{#if access}}
<div class="post-feed gh-feed gh-canvas">
{{#foreach posts}}
{{> "loop"}}
{{/foreach}}
</div>
{{pagination}}
{{else}}
<h3 style="margin: auto; width: 50%; padding: 10px;">You need to be a member to view posts. Click "Subscribe" in the upper-right to begin!</h3>
{{/if}}
How do I fix this, or what have I done wrong? Everybody is seeing the text of the else statement.
Here’s the article I was looking at - Ghost Theme Development: Building custom membership flows