- Sitecore Cookbook for Developers
- Yogesh Patel
- 650字
- 2021-07-16 11:14:58
Empowering the Experience Editor using placeholder settings
Being a content owner, the Experience Editor provides a simpler user interface to change the page design. In this recipe, we will take a look at how to add components from the Experience Editor using Placeholder Settings.
Getting ready
In the previous recipe, we placed different components on different placeholders, for example, the Title and Body rendering on the main-content
placeholder. We will place Carousel
or any other rendering on the same placeholder from the Experience Editor.
How to do it…
As we want to place components on the main-content
placeholder of the Home
page from the Experience Editor, we will first create a placeholder setting for it:
- From the Content Editor, select the
/sitecore/layout/Placeholder Settings
item. Create a placeholder settingmain content
item in it. In its Placeholder Key field, enter the name of the placeholder that we defined in theMain Layout
, for example,main-content
. - Now open the
Home
page in the Experience Editor. Find the Title and Body rendering that is placed on themain-content
placeholder, as shown in the following image. From the floating toolbar visible there, click on Go to parent component to reach its parent component, which is themain-content
placeholder in our case. Now, you will find two Add here buttons in themain-content
placeholder to place components before and after the Title and Body rendering: - Clicking on this button will open a Select a Rendering dialog, from which you can select a component to add to that place. Select the Carousel rendering to place it before the Title and Body rendering, save the changes, and see how your page has been changed!
How it works…
There are two types of placeholder settings: global placeholder settings and data template specific placeholder settings.
In the preceding steps, we used the global placeholder setting as we specified a placeholder key in the placeholder setting. So, whenever Sitecore finds the main-content
placeholder in any component of the requested page, it will allow us to manage components on that placeholder. In our case, it will be shown on all the pages of the website. So ideally, it's good practice to use the global placeholder setting for placeholders of the main layout of the site.
We can also set placeholder settings on the data template level. For example, we want to restrict the main-content
placeholder setting only for Site Root
or other selected templates. For this, we should follow these steps:
- In the placeholder setting that we created, don't specify the Placeholder Key field (leave it blank) so that we can override it on the template level.
- Select the standard values of the
Site Root
template. Open its Layout Details, and select the Select the Placeholder Settings tab in the Device Details dialog. Click on the Add button, which will open the Placeholder Setting dialog. Here, select the created placeholder setting, main content, and set themain-content
placeholder name, as shown in the following image, and save the settings:
Now you will be wondering how Sitecore adds the components directly to Layout Details of the page. Open the Layout Details of Home
item; you will find that the Carousel
rendering we added from the Experience Editor got stored to FINAL LAYOUT, where SHARED LAYOUT is still the same as before, as shown in the following image. This is because of the Versioned Layouts feature we got from Sitecore 8. Read more about it at https://goo.gl/FXxHkP:

You can also remove any components by clicking on the Remove component. button found on the floating toolbar of the component, as shown in the following image:

Learn more about the Experience Editor at https://goo.gl/1ZFIpX.
- Photoshop智能手機APP UI設計之道
- 構建移動網站與APP:HTML 5移動開發入門與實戰(跨平臺移動開發叢書)
- 深入淺出WPF
- INSTANT Sencha Touch
- 零基礎學Python數據分析(升級版)
- HTML5+CSS3網站設計基礎教程
- Android底層接口與驅動開發技術詳解
- SQL Server 2016數據庫應用與開發
- Java實戰(第2版)
- Statistical Application Development with R and Python(Second Edition)
- Python編程:從入門到實踐(第3版)
- Magento 2 Beginners Guide
- Python數據預處理技術與實踐
- Java面向對象程序設計教程
- C語言程序設計實驗指導