There are a selection of helpers in Ghost Handlebars themes that help to scope content to your members. The following sections explain these helpers and provide examples of how they can be used.
Content
Any member that arrives on your site will have an access level attached to them. To correspond, all posts have a visibility setting attached to the content. This setting is applied when you select a post access level.
If the member's access matches, or exceeds, the access level of the post they will be able to view the content of the post.
access
access is a variable that is calculated between the access level of the member viewing the post and the access level setting applied to the post. access will return true if the member's access matches, or exceeds, the access level of the post.
Access example
<h1></h1>
<p>Thanks for being a member...</p>
<p>You need to become a member in order to read this post... </p>
@member
The @member helper can be used to scope anything in the theme to only people who have become a member of the site. To scope parts of a theme to members only use an #if statement in the following fashion:
<p>Thanks for becoming a member π</p>
<p>You should totally sign up... π</p>
Additionally, @member can be used to check for paying members as well. @members.paid will return as true if the member has become a paying member:
<p>Thanks for becoming a paying member π</p>
These two boolean values can be used in conjunction to customise UI and messages within a theme to particular audiences:
<p>Thanks for becoming a paying member π</p>
<p>Thanks for being a member π</p>
<p>You should totally sign up... π</p>
visibility
The visibility helper is relative to the post, or page, and is useful for providing templates with extra attribute information depending on the viewer status. visibility has 3 possible values: public , members or paid .
visibility examples
<article class="post post-access-">
<h1></h1>
</article>An example use case could be to show a particular icon next to the title of a post:
<h1>
<svg>
<use xlink:href="#icon-"></use>
</svg>
</h1>visibility in posts
Posts flagged for members only won't be shown when using #foreach with the posts helper. To show all posts, including members only posts, use the visibility="all" flag:
<article>
<h2><a href=""></a></h2>
</article>
While this flag will show members only posts in the posts list the {{content}} of the posts will still be restricted to members.
visibility with #has
Using the visibility flag with the #has helper allows for more unique styling between public, member and paid posts. Example:
<article>
<span class="premium-label">Premium</span>
<h2><a href=""></a></h2>
</article>