In the part one of this post, we saw what a Placeholder Setting is and why is it good to use Placeholder Settings in architecturing of our Sitecore Projects. In case you missed it, have a look at it here – Placeholder Settings – Empower your Page Editor Users How to Setup Placeholder Settings? Suppose we are developing a Site with a blog. So lets configure various elements considering that blog has the following layout:
Various presentation components that we need for the blog are as follows:
Next, lets create a Placeholder Setting item. At the location /sitecore/layout/Placeholder Settings right-click and say insert Placeholder.
Now, we can have the following components in our left Sidebar:
- Blog Roll
- Recent Comments
- Featured Posts
- Recent Posts
- Subscribe to Blog
- Blog Stats
- Blog Authors
- Blog Archive
So lets add them in Allowed Controls of the setting.
Please note, that in the above screenshot, we haven’t specified any Placeholder Key. This means, it is a Data-Template Placeholder Setting. So, we need to add this setting to the Presentation Details all the blog related items (ideally to blog related template’s standard values).
[Moving a step back from our configuration step, lets discuss why we used a Data-Template specific setting, and how beneficial can it be in our case. The advantage of making a global Placeholder Setting, is that we have the Placeholder Key already specified in the Setting and we do not need to add it to the Presentation Details of that of the item or template standard values. Sitecore identifies, where to apply it, based on the Key that is specified in the Setting. But, its good to use it only if the site follows a single main layout.
Taking our current case of that of the Blog Section of a Site, we are using Sidebar with the key leftSidebar. Lets say, we make this setting as Global, and we have the same key in different layouts for other Site Sections (say Our Services Section) , then these Blog related Presentation Components, will be available for Page Editor users, to be added in Our Services Section, which is conceptually wrong. So to avoid such cases, whenever we have multiple layouts section-wise its always good to create Data-Template specific placeholder settings. Also, in a case where we have a website setup, and we found later that Placeholder Settings could be useful for us to use, its preferable to make it Data-Template specific instead of Global Placeholder settings to avoid major level of testing into it. ]
Coming back to our How to configure Placeholder Settings, adding the Sidebar Placeholder Setting item, to the Presentation Details of the Blog Section Template’s Standard values and specifying the Placeholder Key as “leftSidebar”.
Once added, it can be seen in the presentation details of every item of that template and when we can click on it, we can see the controls that can be added to the specific Placeholder Key, by our Page Editor Users.
Once this is done, we can start adding components to the left Sidebar. Say we have added Blog Archive.
And some of the following (Recent Posts and Featured Posts) might be added by client in future, so he/she doesn’t need to depend on us, or come to us to get it added. Their Page Editor users can do the same as follows:
As we want to add a new Component, that of Recent Posts, above this blog roll component, we click on the Add to here button above it. Note that, when we hover over the Add to here button, here’s what we see:
The Placeholder’s name is replaced by the Placeholder Setting’s name. And now, on clicking it, we get all the allowed controls.
I’ll Select the Recent Posts Component, and that’s how it looks on my page, in Left Sidebar.
Hope you enjoyed the couple of posts on Placeholder Settings? Lets make use of various things, simple in use yet very powerful features and make situations for our clients and stakeholders easy!
Happy Sitecoring! 🙂