Members-only content in AMP

Hi,

I have a new blog at https://mbohlen.de

There is one post that is marked as members-only: https://mbohlen.de/remote-training-ausrustung/
My template is written such that (for non-members) it shows a sign-in box below the excerpt of that article.

I published a link to that post on Twitter. When I tap on the tweet in Twitter on my iPhone 11, the featured image is shown but the body of the article is not. I found out that Twitter is not the problem – it is simply trying to show the AMP version of the post! See this: https://mbohlen.de/remote-training-ausrustung/amp/ – the body of the post is empty!

My question: Do I need to write a custom amp.hbs file for my site to fix this? What do I need to write into it if it is to show members only content, depending on who is logged in or not?

You could approach this in a few ways:

  • Create a custom amp.hbs template that has placeholder content and a link to a subscribe page
  • Turn off AMP entirely, via Integrations in Ghost admin
  • Create redirects that go to the original page and prevent the AMP page from being shown

Depends on what you’d prefer and whether you want to get any benefit from AMP :slight_smile:

so AMP page can’t handle members only content?

It can handle it. I would just have to write a custom amp.hbs file for it, just as I edited a post.hbs for my theme.

Correct - but IMO that would be the most complicated route and it might not provide much extra benefit. It depends on how important AMP is for the rest of your content?

For example:

Option 1: If most of your site content is Public and you benefit from having AMP turned on, then personally I’d use manual redirects for any Members only content to ensure people always land on the non-AMP version of those pages.

Option 2: If most of your site content is Members only - I’d probably turn AMP off entirely. The whole point of AMP is to provide a faster mobile experience for public content. It’s not really that useful for accessing content that is protected.

Option 3: You could still update your amp.hbs if you prefer, and use placeholder content that contains a link to your subscribe page, but this is definitely more complicated and might just cause extra friction, compared to sending people directly to the non-AMP page :slight_smile:

Of course it’s entirely your decision. This is my two-cents!

We have a tutorial for editing amp.hbs. You may also want to check out our Members theme docs.

2 Likes

Great! Thanks a lot, Kym!

1 Like