0

I have a requirement to build several components for a basic page, component such as TwoColumnsRichText, ThreeColumnsRichText, CallToActionBlock, etc. they want the flexibility add one or more of those components to the page.

Here is how I build them:

  1. Create a template to hold the data for each type of component
  2. Build a controller rendering for each component (model, view, controller)

I showed them how to add the components to the page in the following steps:

  1. Create the page
  2. create data from template under that page and fill out the fields
  3. add rendering to the page and select the above data as data source (via presentation details)

They complained that the steps are complex and they want to add the component to the page and be able type in the data (without another step to add data from template - step 2 above).

Is there a way to achieve this editor experience in Sitecore?

Thank you very much!

1 Answer 1

1

The process you are following is the recommended process of creating components in Sitecore. If you will add all the fields on the page itself then they will not be reusable.

For example, if the TwoColumnsRichText component you want to use on another page type then you need to add the same fields on that page template too.

The best solution is to add these renderings and their blank datasources automatically when they create a page in Sitecore.

for this you can use the following approaches.

If you are working with Sitecore SXA then you can use Page branches to achieve this. In page branches, you can add rendering and data sources and use the rules to add them to the insert option. So once user creates a page using page branch then the items will be automatically created for him.

enter image description here

For non sxa, you can go with Branch templates. So same way you can add datasource items and when you will create page using branch template then the structure will be created.

enter image description here

You can go through the Sitecore docs for more details of them.

Hope this makes sense.

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.