Skip to main content

Lesson 1 of 6 · 4:00 · Beginner · Webflow

Gate your first page

Lock a page to logged-in members or a specific plan, and choose where everyone else goes.

Where this journey starts

You finished Plans and payments with free and paid plans that work together. Now you’ll make those plans mean something, starting with one page only paying members can open.

By the end of this lesson you can

  • Add an access denied page from the Memberstack components library
  • Create a gated content group that restricts a URL to one plan
  • Show or hide a single element for members, non-members or one plan

Lesson notes

How it works

How Memberstack decides who can see a page

A gated content group is a rule you set in the Memberstack dashboard. It has a name, a list of restricted URLs, the members it grants access to, and an Access Denied URL. When someone opens a page, the Memberstack script on your site compares the page URL with your restricted URLs. If the page is restricted and the visitor is not a member with access, Memberstack sends them to the Access Denied URL instead.

Grant access to has two choices: all members, which means anyone who is logged in, or members on specific plans. You can add more than one plan to the same group. Each page or folder can only be gated once, so if you want two plans to reach the same page, add both plans to one group rather than making two groups.

This check runs in the browser. If Memberstack fails to load and someone knows the exact URL, they can reach the page. That is fine for most member areas. For things you sell, use hosted content, which comes later in this journey.

  1. In the dashboard, open Gated Content and click Add.
  2. Name the group. Keep it short, because Memberstack builds the group's content ID from the name.
  3. Under Grant access to, pick members on specific plans and choose your paid plan.
  4. Under Restricted URLs, choose Equal to and enter the page slug, for example success-paid.
  5. Enter your access denied page slug in Access Denied URL and click Save.
  6. Open the page in a logged-out browser window to check that you land on the access denied page.

Why you need an access denied page

You could send blocked visitors to your homepage, but a dedicated page tells them why they were stopped and what to do next, like upgrade or log in. The Components page in your Memberstack dashboard has ready-made access denied designs you can copy and paste into a blank Webflow page. Publish it before you point a group at it.

Don't gate your homepage. Visitors need at least one open page, and gating the homepage often causes a redirect loop.

How to show or hide one element with data-ms-content

Gating a URL blocks the whole page. To control one element on a page, add a custom attribute in Webflow with the name data-ms-content. The value decides who sees it.

data-ms-content="members" shows the element to anyone logged in. data-ms-content="!members" does the opposite: the exclamation mark flips the rule, so only logged-out visitors see it. To tie an element to a plan, use the content ID of a gated content group, for example data-ms-content="CONTENT-ID". You'll find the content ID on the group in the Gated Content page. Add ! in front to show the element to everyone without access, which is handy for upgrade prompts.

Before you move on

0 of 5

Tick these off on your own site. Done with all of them? You’re ready for the next lesson.

Up next: Next, you’ll set the defaults for members who sign up without a plan.

Chapters

Common questions

Can I gate the same page for two different plans in Memberstack?

Yes. Each page or folder can only be in one gated content group, but a group can grant access to several plans. Add both plans to the same group.

Is Memberstack gated content secure?

Gated pages are protected in the browser. If Memberstack fails to load and someone knows the exact URL, they can reach the page. For files or content you sell, use Memberstack's hosted content, which only sends the content after the member is authenticated.

How do I show an element only to logged-out visitors?

Add the custom attribute data-ms-content="!members" to the element. The exclamation mark reverses the rule, so the element hides once someone logs in.

Keep going

Checked against the Memberstack docs

TranscriptAuto-generated captions
  1. 0:00

    One of the most important aspects of any membership-based site is gated content making it so only people who should be allowed to access the content are the ones who can access it let’s go ahead and set that up we have this success paid page here and let’s just say we want to get this we only want people who’ve paid to be able to see this so right now if I open a new tab and paste in that success page then it will take me there even though I’m not signed in I don’t have the plan nothing let’s stop that from happening now what we’re going to need to do you can just gate it and

  2. 0:31

    send people to the home page but it’s probably better to give them some sort of access denied page I’ve made this blank page here let’s head over to Memberstack and go to our components where we’re going to get an access denied page if we go through here should pay well there we go all right now we’ve got a couple and let’s grab this one here because it probably matches the partial design that we have on the site more than any of the other ones so copy that go over here and paste this upgrade to access content beautiful

  3. 1:03

    that is our access to night page let’s publish that and then head back over to membersack where we’re going to actually set up our gated content rules here we are again let’s click gated content and click gate content let’s just call this paid only Grant access to yes members on specific plans you can also click all members if it’s something that you just want logged in visitors to be able to see not Anonymous visitors in this case members on specific plans and let’s click paid just like that so restricted URLs what we can do here is

  4. 1:36

    add a URL we can select starting with or equal to Let’s head back into Webflow here and get our success paid URL as we can see here it is Success Dash paid let’s make that work and let’s do equal to success paid and our access to nine URL the page we just set up is access dash deny there are some other things in here but we’re not going to touch them for now let’s go ahead and save that now if I

  5. 2:07

    over here success paid on my non-logged in browser don’t try to open that as we can see what is going to happen is it’s going to take us to access denied it is not going to let us access that other page well that’s how you gate entire pages but what about gating individual pieces of content this page here is where people are being redirected if they don’t have the paid plan let’s go ahead and just go back here into Webflow click that page and let’s say this is upgrade to access content let’s say for example

  6. 2:40

    we want to show an additional message saying you don’t have an account and we only want to show this to people who are logged in let’s click that right now and then go over here to content type and do gated content ID members let’s save that and publish now this is going to show to anyone who is a member and I am not a member so we don’t have it now let’s say we want the opposite we want it to only show to

  7. 3:12

    non-members so me in this case as you can see it’s going to add an exclamation mark in front let’s save that and let’s publish that and then what we’re going to see is this is actually going to show to me there we go now it’s saying you don’t have an account and that works with members it also works with plans so what I can do over here is as we can see in Webflow it asks for the content ID just like that and the content ID for the plan is something that you can find over

  8. 3:43

    here this is the price ID and then if we go to gated content which we’ve set up it has our content ID right there so if I use this instead of members it is only going to show to people who have the paid plan that is it for gating content

This is v1 of Memberstack University, built from the tutorials we’ve put so much work into over the years. We’d like to make a more organized series.