惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
量子位
博客园 - 三生石上(FineUI控件)
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
V2EX
人人都是产品经理
人人都是产品经理
V
Visual Studio Blog
Jina AI
Jina AI
L
LangChain Blog
M
MIT News - Artificial intelligence
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学

Example blog

Ghost routing explained with routes.yaml examples — routes, collections & taxonomies Ghost redirects explained with practical redirects.yaml examples How to Serve JSON or XML Data in Ghost How to Change Your Default Post Template in Ghost Ghost Custom Theme Settings How to add Google Fonts to Ghost Themes How to Configure Ghost with Mailgun Ghost Theme Structure & Organization How to Make Custom Templates in Ghost Themes How to Install Ghost CMS via Ghost-CLI How to Add Syntax Highlighting to Ghost The best Ghost CMS hosting platforms Ghost 6.0 — Social Web and Native Ghost Analytics Ghost CMS Social web beta, email 2FA and more author social links How to keep custom design settings when updating your Ghost theme How to use the public preview card in Ghost How to customize the default content CTA in Ghost How to build a custom homepage in Ghost An overview of Ghost editor cards and and how they work Ghost CMS News: One-time payments & collecting sales tax How to customize the private site access template in Ghost How to add custom fonts in Ghost themes Ghost CMS News: Additional payment methods & internal linking How to use Code Injection in Ghost How to set meta data of your custom routes & collections in Ghost Ghost CMS News: TK reminders, ActivityPub and improvements How to format dates and use the date helper in Ghost Ghost CMS internationalization, custom fonts & spam protection Understanding and optimizing post and page settings in Ghost CMS Trigger the Ghost Portal popup based on page scroll progress
How to add members-specific sections in Ghost
Bright Themes · 2025-02-25 · via Example blog

Starting with Ghost 4.0 memberships and newsletters are natively part of the platform, Ghost is not just a blogging platform anymore but with the features that have been added it's much more than that.

When we are talking about post content you can check out this guide for using the public preview and customizing the content CTA.

For some more advanced changes related to different templates you have and to really take advantage of these features you might need to adjust your Ghost theme and make some sections of your site free member or paid member specific. This can be done quite easily with the helpers provided by Ghost:

{{#if @member.paid}}

  {{! Content for paid members }}

{{else if @member}}

  {{! Content for free members }}

{{else}}

  {{! Content for regular users }}

{{/if}}

These are the conditions you can use in your Ghost template files to check whether the current user is a paid member, free member or a regular user. You can use this to customize your theme.

Next, let's see some use cases, besides the post content.

Custom account page

You can create custom account page if you don't want to use the Ghost Portal feature. When creating such a page, you can show different content to users depending on their status.

For a paid member you can build a profile using the member attributes provided by Ghost. Then the member subscription attributes can be used to show the subscription info of the user, such as the status of the subscription, until when the subscription is valid and much more.

You can even show a preview of posts depending on the access level of the current user.

For free members you can build a profile section using the member attributes similarly to paying users. Another section that can be great for free members is a way to upgrade and for this you can build a checkout section containing the different tiers available, monthly and yearly pricing with details and an easy way to subscribe.

Regular users should have no access to the account page, for them a redirect can be implemented:

<script>
  window.location = '{{@site.url}}/signin/';
</script>

Check out the account page in our Dashi theme.

Custom membership page

A membership page can be a great way to list the different tiers users can subscribe to and also give some detail about each plan.

Here is how the structure of such a page would look like:

{{#if @member.paid}}
  <script>window.location = '{{@site.url}}/account/';</script>
{{else}}
  {{#unless @member}}
    {{> pricing/free}}
  {{/unless}}

  {{> pricing/monthly}}
  {{> pricing/yearly}}
{{/if}}

Paid members would be redirected to the account page, as that one would give the information about their subscription.

The free plan would be shown only to regular users, if we are dealing with a free member then we only show the premium plans, the monthly and yearly pricing plans.

Check out the membership page in our Dashi theme.

Besides the specific pages like membership and account, you might want to show different content to members in the header like additional links, or even in the footer or sidebar sections you can use the conditions to optimize the content.

In the header section you can use the checks to either show "Login", "Subscribe" buttons for regular users, or simple "Upgrade" to free members, while for paid members you can show an "Account" link.

In the footer or sidebar section of a theme you can implement a subscribe form, which should not be displayed for paying members. That could be handled like this:

{{#if @member.paid}}
{{else if @member}}
  <h4>{{t "Premium Membership"}}</h4>
  <div>{{t "Unlock full access to see the entire library by subscribing to a paid plan."}}</div>
  <a href="/membership/">{{t "Upgrade"}}</a>
{{else}}
  <h4>{{@site.title}}</h4>
  <div>{{t "Get the latest insights directly to your inbox!"}}</div>
  {{> subscribe-form}}
{{/if}}

Paying members would not see this section, free members would get a cta to upgrade with a link to the membership page and regular users would see a form where they can subscribe and become members. These are just a couple of use cases, but there can be much more.

I hope you found this guide helpful.