官术网_书友最值得收藏!

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:

  1. From the Content Editor, select the /sitecore/layout/Placeholder Settings item. Create a placeholder setting main content item in it. In its Placeholder Key field, enter the name of the placeholder that we defined in the Main Layout, for example, main-content.
  2. Now open the Home page in the Experience Editor. Find the Title and Body rendering that is placed on the main-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 the main-content placeholder in our case. Now, you will find two Add here buttons in the main-content placeholder to place components before and after the Title and Body rendering:
    How to do it…

    Note

    As an alternative to this step, you can also find all the placeholder settings on the page directly. For this, from the Experience Editor ribbon, in the Home tab, in the New group, click on the Component button.

  3. 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:

  1. 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.
  2. 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 the main-content placeholder name, as shown in the following image, and save the settings:
    How it works…

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:

How it works…

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:

How it works…

Learn more about the Experience Editor at https://goo.gl/1ZFIpX.

主站蜘蛛池模板: 贡嘎县| 辛集市| 海淀区| 子洲县| 平安县| 凤冈县| 怀化市| 北海市| 龙州县| 清流县| 武清区| 左贡县| 宁化县| 洪洞县| 澄城县| 白玉县| 青海省| 新田县| 四平市| 兴仁县| 开化县| 永宁县| 柘荣县| 威信县| 安福县| 祁连县| 邹平县| 岐山县| 拜泉县| 永德县| 涞水县| 东乌珠穆沁旗| 三台县| 福清市| 织金县| 中宁县| 无极县| 桦川县| 大田县| 周宁县| 禹州市|