Hide Posts for User Without Access

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

Access is specific to individual posts. So you’d need to move the logic into the loop partial. Or perhaps if you have a mix of public and not public content, you’ll want to retrieve different content based on @member.paid or @member being truthy.

Member Paid doesn’t necessarily mean the member can access something if there’s multiple membership tiers.

What do you mean by move the logic into the loop?