Sitecore – Placeholders and placeholder settings

As we learnt about the renderings in the last blog, we saw that for dynamic binding of renderings we need placeholders. Placeholders will help us to make the website as dynamic as possible but with this flexibility we might increase the chances of error as well so we will need to configure some settings so that with the restrictive model we can take advantage of placeholders as much as possible.

Now we will understand why we need placeholders and placeholder settings.

If we don’t use the placeholder then each component we need to statically bind to the Layout. If this is a case then the flexibility to change the page design with minimal efforts is lost. So we are using placeholders to dynamically bind the components/renderings to the layout as we saw in the Controller rendering. Now you will have a doubt that we did dynamic binding then why we need placeholder settings.

Let’s understand this in detail. Now you as a developer have setup Controller rendering using a placeholder key ‘main’. When the content Editor is trying to edit (Remove the rendering) it in Experience editor, s/he is not allowed and dependency comes back to you. To remove this dependency, we need to create placeholder settings so that content editors can make a full use of the experience editor.

Let’s examine the scenario we discussed.

  1. Go to the Test Item (/sitecore/content/Home/Test Item).
  2. Click on Publish tab >> Experience editor.
    SRG244
  3. There is no placeholder setting for ‘main’ is present.
  4. Click on View tab >> uncheck Editing >> Check Designing checkbox.
    SRG245
  5. Now hover on the Controller rendering part and click on it.
    SRG246
  6. If you see most of the options are disabled. To enable these options we will need to create main placeholder setting.
  7. Go to the Content editor tab.
  8. Navigate to Placeholder settings (/sitecore/layout/Placeholder Settings).
    SRG247
  9. Right Click >> Insert >> Placeholder
    SRG248
  10. Name it ‘main’ and Click OK.
  11. Reload the Experience editor. Hover on Controller rendering part and click on it.
    SRG249
  12. Now the options are enabled. Click on the Delete option and delete the rendering.
    SRG250
  13. Now if you again click in the area of the component. You will see an Add here option. Click on that button.
    SRG251
  14. It gives us an ability to add any rendering. This can be the possibility of error as the content editors will not be familiar which one to be used. So we need to give them only few no. options to be used in one placeholder.
  15. Again switch to Content Editor. Navigate to main placeholder setting. (/sitecore/layout/Placeholder Settings/main)
  16. Click Edit under Allowed Controls field (second field).
    SRG252
  17. Select Controller rendering and View rendering in the pop up.
    SRG253
  18. Click Ok. Save the changes.
  19. Reload the Experience Editor.
  20. Click on Add here button. Now you will be able to see only 2 options. This minimizes the error that content editor can cause.
    SRG254
  21. Select any of the component/rendering you wish to assign and click Select.
  22. Save the changes. Publish Test item.
    SRG255
  23. Browse http://learningsitecore/test-item
    SRG256

This completes the placeholders and placeholder settings. There is one more concept of dynamic placeholders that we will go through now. Till now we have learnt Static binding, Dynamic binding, Placeholders, and Placeholder settings. The placeholders which we learnt can be known as Static placeholders as the key will remain same at any given time.

In the next blog, we will learn about the dynamic placeholders and it’s importance.

Thank you.. Keep Learning.. Keep Sitecoring.. 🙂

One thought on “Sitecore – Placeholders and placeholder settings

  1. Pingback: What are Renderings? Which ones we frequently use? | Sitecore Dairies

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s