Using built in and custom blocks within the pages application, gives you a powerful way in which to build up pages with the right content for your consumers. In this guide, we show how it is possible to build a single page, showing different content to different groups of people.
Our aim in this guide is to have a single page that shows differently to people who are logged into your site, as it does to guests. To do this we are going to set up the following items
- Create 2 custom blocks for guests
- Create a custom welcome block for logged in users
- Build a page to show content and these new blocks
Our intention here is to have 2 blocks of information to show to guests, which we will display side by side, and one block which will show full width as a welcome block to members who are logged in. So to start we will go to the following location of our Admin CP, and select to create a new block
For this exercise we will be using the editor blocks so that we can add some custom content.
We need to ensure we give the block a recognizable name, as we will need to choose this on the front end later. We will be calling our blocks 'guest info', 'guest info 2' and 'welcome block'
Move on to the content section, and add some content for your first guest block. For the sake of this guide, we will just add an image and some dummy text
Once done, click on save, and you will be given the permissions screen to add your permissions in. Here we want to add in permissions just for guests to be able to see, as when we add it to our page, we want this to be suppressed from anyone who is not logged in
Repeat this exercise again, and create another block named "guest info 2" with different content, but the same permissions, so that we now have 2 blocks we can place side by side.
Now we have created our guest blocks, we are going to create a single block named 'welcome block' which will span the width of the page, and welcomes our logged in members. Create a block and add some welcoming text
Once you create this and save, we want to add the opposite permissions to that of the guest blocks. We only want logged in users to see these.
That is our custom blocks created. You could then go ahead and create as many blocks as you like, showing to the groups you need them to show to.
Now on to creating the page itself.
To create our page, first we will go to Pages->Page Management->Pages and sect to Add a new page from the link shown below
Once we have done this, add a name for your page, and then save. In our case we will simply be calling it "Home"
Once added and saved, we need to go to edit the page itself, and add our blocks on. So we will now click the page builder link which is shown here
Once in the page builder, we are going to use the block manager to add blocks to the page. We need to remember here that blocks will only show to those who have permission to see some content within them. This is how we will achieve a different view for different people.
First we can drag over a guest signup widget. By definition, this will show only to guests. We can add a short line of text to this for now, but you can of course add anything you wish
You add to this by clicking on the edit button once its dragged to the page. We are just going to add "we would love you to sign up to our community" as shown
Next add in a topic feed block anywhere on the page. As blocks follow the same permission rules, it will only show guests what they are allowed to view, and our members can see everything they are allowed to also.
Once that is added, we will now add some custom blocks, as shown. You can add these anywhere you wish on the page. You will see where I have added them for this example here
Once added you need to edit each of the custom blocks, and select the custom items we created in the first part of this walk through. In this case I have used the welcome block you can see at the top, and the 2 guest blocks at the bottom.
The result of this, is that when you click save, you see different content as a guest than you do as a logged in member. Below are the 2 different views for our example.
Here you see the guest signup block, the topic feed showing only guest available topics, and the 2 guest blocks we created
Once logged in, you see the view is very different. We now see the welcome block for our members, and just their topic feed.
You could add moderator only blocks if you wished, or blocks for your sponsors and more to create more unique experiences for different sets of members