# Trouble accessing labels from post.hbs

**URL:** <https://forum.ghost.org/t/trouble-accessing-labels-from-post-hbs/38230>\
**Category:** Themes\
**Created:** [May 4, 2023, 1:26pm UTC](https://forum.ghost.org/t/trouble-accessing-labels-from-post-hbs/38230 "2023-05-04T13:26:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronan](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ronan/32/23979_2.png) [@Ronan](https://forum.ghost.org/u/Ronan)\
**Post date:** [May 4, 2023, 1:27pm UTC](https://forum.ghost.org/t/trouble-accessing-labels-from-post-hbs/38230/1 "2023-05-04T13:27:00Z")

</div>

Hi folks, I would like to access a member’s labels from the post.hbs file.

Here is the code I am using to show the labels on the post if the member is logged in and not paid:

```auto
    <section class="gh-content gh-canvas">
        {{#if @member}}
            {{#if @member.paid}}
                {{content}}
            {{else}}
                <div class="gh-login-prompt">
                    <p>Post URL: {{url}}</p>
                        {{#if @member.labels}}
                            {{#each @member.labels}}
                                <p>{{this}}</p>
                            {{/each}}
                        {{else}}
                            <p>No labels associated with this member.</p>
                        {{/if}}
                </div>
            {{/if}}
        {{else}}
            <div class="gh-login-prompt">
                <p>Please <a href="{{@site.url}}/#/portal/signin">log in</a> or <a href="{{@site.url}}/#/portal/signup">sign up</a> to view this content.</p>
                <p><a href="{{url}}">View Post</a></p>
            </div>
        {{/if}}
    </section>

```

Currently, this is just showing “No labels associated with this member.” even though there are multiple labels associated with this member.

---

<div class="post-metadata">

**Author:** ![RyanF](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ryanf/32/17448_2.png) [@RyanF](https://forum.ghost.org/u/RyanF)\
**Post date:** [May 4, 2023, 2:39pm UTC](https://forum.ghost.org/t/trouble-accessing-labels-from-post-hbs/38230/2 "2023-05-04T14:39:49Z")

</div>

Labels aren’t available within the templating layer. To see which data is available, check this out: [Ghost Theme Development: Building custom membership flows](https://ghost.org/docs/themes/members/)

---

<div class="post-metadata">

**Author:** ![Ronan](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ronan/32/23979_2.png) [@Ronan](https://forum.ghost.org/u/Ronan)\
**Post date:** [May 4, 2023, 4:40pm UTC](https://forum.ghost.org/t/trouble-accessing-labels-from-post-hbs/38230/3 "2023-05-04T16:40:33Z")

</div>

Thanks @RyanF , I appreciate that clarity and was thinking that may have been the case.

I’m trying to build some micropayments functionality so that a member can pay to get access to just one post. Ideally I would have a way to attach metadata to a user, in a way that the metadata can be available from the templating layer. It seems this isn’t possible?

Alternatively I could tag each post with the names of users who have access. However, that will result in a lot of tags per post.

Have you any other suggestions?

I suppose the last alternative is to conditionally show content after posting to an external that returns the status of the member with respect to that post.

---

<div class="post-metadata">

**Author:** ![RyanF](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ryanf/32/17448_2.png) [@RyanF](https://forum.ghost.org/u/RyanF)\
**Post date:** [May 4, 2023, 5:17pm UTC](https://forum.ghost.org/t/trouble-accessing-labels-from-post-hbs/38230/4 "2023-05-04T17:17:05Z")

</div>

This won’t be trivial to implement because you have payments, users, auth, content, and integration. You’d need to set up some kind of proxy service (server, db) that uses the Admin API in conjunction with other APIs/SDKs.

> **[Ghost Admin API Documentation](https://ghost.org/docs/admin-api/)**
>
> Manage content via Ghost's Admin API, with secure role-based authentication. Read more on Ghost Docs 👉

---

<div class="post-metadata">

**Author:** ![Ronan](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ronan/32/23979_2.png) [@Ronan](https://forum.ghost.org/u/Ronan)\
**Post date:** [May 4, 2023, 5:55pm UTC](https://forum.ghost.org/t/trouble-accessing-labels-from-post-hbs/38230/5 "2023-05-04T17:55:59Z")

</div>

Yeah agreed, I’ve been able to build a plugin pretty easily for WordPress but it’s just challenging here because I either have to really get into Ghost core, or, as you said, replicate a lot in a proxy service.

I appreciate the answers, nonetheless. I’ll mark this resolved.
