I hit an interesting issue I’m hoping you can help me with. Forgive me for not having a 100% reproducible example here - It’s possible that I’m just doing something wrong with how I’m using {{content}} and context…
I was trying to create a .hbs file for a page that would pull content from a couple of other pages/posts. I’ve done this lots of times before, for example, to build a custom index page for posts. In this case, however, I needed the CONTENT of the page, not just title and excerpt. I can do this just fine, IF the pages/posts are available for all members. However, in this case, I have pages that are restricted to paid members with a specific tier. The page template I am aggregating the contents to is also restricted to that tier.
So I have a {{#get pages}} to get the pages whose data I want to include, and then a {{#foreach}} to loop over them. (Along with some #match logic to make sure that only pages the user is allowed to access have contents included.) That got me access to the {{title}} and {{excerpt}}, authors, tags, etc. But when I added {{content}}, all I got from the content helper was the public preview and call to action. To be clear, I was definitely signed in as a user who has access to the contents. And visiting the contents pages directly works fine. But {{#get}}-ing pages with these contents and looping over them produces only the CTA and any public preview.
I don’t see documentation on the {{content}} helper really. Am I missing something obvious? How can I get the content helper to understand that the user has access? Or to ignore checking for access?
Documentation, hints, or working examples would be much appreciated. For my client, it’s going to be the difference between being able to edit her content or not (as my workaround has a bunch of extra stuff hard-coded that shouldn’t be), so thank you in advance for any help!
Public and paid pages work as expected. But when I restrict the page to a specific tier, I don’t get the content returned for that user, although clicking the link to go directly to the page in question works fine and gives me the full content.
Update: Not a page-specific gremlin. The problem also occurs with posts instead of pages.
And I pushed this theme code to Ghost Pro, so it’s not that my dev box is out of date. :)
One other observation: For tier-restricted posts/pages, I’m getting NEITHER the content, NOR the CTA text. (When my user is logged out, I get the CTA were expected on paid content.)