2

In SXA's carousels, slides only take one rich text to display their content. I would like to have a testimonial slide which has a title and a content, so that the contributor doesn't have to structure its text with HTML but just fill in the two fields.

I have created a TestimonialSlide template inheriting from SXA's Slide template and adding three fields,

  • Name
  • JobTitle
  • Testimonial

The template is referenced in carousel's insert options. I can therefore add a TestimonialSlide to a carousel but then it freezes. Of course, it is not linked with any Model, Controller nor any View.

Here is my problem, I want to link this template to a View, Model, Controller, Rendering but I don't get how the link is done in SXA to copy the same structure. I get the impression that we only link a template and not a rendering... I am confused !

Can someone help me link my custom slide template to a View, Model, Controller and Rendering so that it can be added to a Carousel ?

2

1 Answer 1

5

Alright, I figured it out !

There are basically two ways of doing so. In every case, the first div inside the slide shouldn't have any attributes (else SXA Carousel breaks !)

First Way, with rendering variants

It is the most easy to use and also the quickest, but you can't use any controller's logic here

Create Rendering Variant

  1. Go to /sitecore/system/Settings/Foundation/Experience Accelerator/Rendering Variants/Rendering Variants/Page Content
  2. Insert Variant Definition
  3. In inserted variant definition, click insert > field and insert the fields you want to have in you custom slide. You can also add html structure and css classes using section but be sure the first HTML tag does not contain any class !

Create custom slide template

  1. Create custom slide template with appropriate fields (must be exact same names that in variant definition). The template should inherit from Carousel Slide
  2. Add Standard Values
  3. Design Layout on Standard Values, add Page Content in section-content placeholder with Styling > Variant set to the ID of the variant definition you have just defined

Add Template to Carousel's insert options

Second Way, with a rendering

This way is closer to the classic way of using renderings

Create custom slide rendering

  1. Create Controller
  2. Create View
  3. Create Rendering

Create custom slide template

  1. Create custom slide template with appropriate fields. The template should inherit from Carousel Slide
  2. Add Standard Values
  3. Design Layout on Standard Values, just add your custom slide rendering in section-content placeholder?

Add Template to Carousel's insert options

That's it !

5
  • Are you using the browser client for Sitecore? How do you get to "Design Layout on Standard Values?"
    – andrei
    Commented Jul 20, 2017 at 15:39
  • @andrei, I did this on Sitecore Rocks (in Visual Studio). You can also, in the Content Editor select template, on ribbon tab "Options" click "Standard Values". Congrats, you have standard values. To design layout on them, select the standard values item created, and on the ribbon "Presentation" and "Details" on the layout section. Here you have the design layout :) Commented Jul 20, 2017 at 16:12
  • Okay, that's what I thought. I went through all those steps in the Content Editor. My problem is that my rendering variant doesn't appear in the dropdown on the Page Content control for some reason.
    – andrei
    Commented Jul 20, 2017 at 16:24
  • @andrei, ok, I checked and the variant for the page content does appear in the dropdown in m case. Did you reference the variant in your site ? In which case it seems logical that it is not reached by a template defined outside the site or did you define it in /sitecore/system/Settings/Foundation/Experience Accelerator/Rendering ? Commented Jul 21, 2017 at 9:59
  • Ah, I see now. I found this after I created the rendering so I didn't notice that you created the rendering in /sitecore/system/Settings/Foundation/Experience Accelerator/Rendering. Thanks for walking through this with me! ;)
    – andrei
    Commented Jul 21, 2017 at 16:15

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.