4

I know (and I do it) that I can put a default value in a placeholder so that when I create a new item for my route type it populates my placeholder with a component that I will choose.

I do it like that :

  • In the Content Editor I get on sitecore > Templates > Project > My Project > My RouteType > __Standard Value
  • I choose the Presentation Tab and I click on details
  • Then I click on Edit and in the new window I click on the Control Tab
  • I click add and I can choose a component and assing it to a placeholder by putting the name in Placeholder [shared] (for example /jss-main if jss-main is my placeholder name)
  • Then when I create a new route type I automatically get the choosen component in my jss-main placeholder.

So this is working and I'm happy with it. What I would like to know is if it is possible to put a placeholder inside another one so that I'll get a component inside another one.

Let's take one example :

  • I have a route type for a glossary
  • I have a default layout that has a placeholder called jss-main
  • I have a component called two-columns that has two placeholders column-1 and column-2
  • I have a component that is name simple-text that has no placeholder

I would like to put in jss-main a component two-columns and in the placeholders column-1 and column-2 from this component put two different simple-text components.

Is it possible to do so and if yes what should I put in the placeholders fields ?

A screenshot of my attempt to include one in another enter image description here

Here is a picture of the experience editor when creating a page with the placeholders like that. enter image description here

1 Answer 1

2

I hope below is the structure of the layout. enter image description here

As you mentioned you have applied component in jss-main placeholder which is correct.

  1. You can apply two-column component on jss-main placeholder which will be like this /jss-main/two-column
  2. Now to apply simple-text component on Column1 and Column2, you can apply simple-text component like this /jss-main/column1/simple-text and /jss-main/column2/simple-text

More Detail:

  1. I have created a layout where I defined placeholder @Html.Sitecore().Placeholder("jss-main")

enter image description here

2.Created Two-Column view html TwoColumn.cshtml

enter image description here

  1. Created rendering for "TwoColumn" enter image description here

  2. Created placeholder

enter image description here

  1. Finally, add rendering in standard value of a page template

enter image description here

12
  • Thank you, you understood the problem well, the structure is correct. Do I need to sort my items or could they be in any order ?
    – Christophe
    Commented Aug 26, 2019 at 12:52
  • This could be in any order Commented Aug 26, 2019 at 12:53
  • It seems that I'm unable to do it : jss-main contain my two-columns component but I'm unable to put my simple text component into it. Is it possible to create items like that ?
    – Christophe
    Commented Aug 28, 2019 at 7:21
  • can you please share screen shot what you have done? Commented Aug 28, 2019 at 9:39
  • Here is a screenshot ibb.co/VMpDjtG the container names are not the same because I'm trying on a simple example : include in jss-main ContentPageMainContainer that contains another placeholder named body-contents and then I'm trying to put in body contents a component name Single column container. After that I'll include another level but I think that if it works with 2 levels it will work for three.
    – Christophe
    Commented Aug 28, 2019 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.