3

We are using Sitecore 9 Update 2 with SXA 1.7.1.

Call to Action component should contain Image, Text and Link components from SXA together.

How to build this kind of component in SXA 1.7.1? Is Snippet component helpful here? Is code needed to build this component?

  • The Promo component gives you exactly that out of the box. Only reason to clone is if you want to call it something different or if you have too many rendering variants of the Promo already – Richard Seal Sep 11 '18 at 16:29
2

Although there is no ootb "CTA" component, you do not need custom code.

What I normally do in such cases:

  1. Create a custom template for "CTA" with the needed fields
  2. Create a copy of "Promo" (see below) and name it CTA
  3. Set the datasource (location and template) for your CTA's (use your template and add a location in the Data folder)
  4. Add this CTA rendering to your allowed renderings on the site
  5. Create a variant for this new rendering to display the fields and such (the name of the variant is the exact name of your rendering - the name of the variant definition can be anything.. you might even create more than one)
  6. You should be good to go..

To create a copy of Promo you can use the official docs: https://doc.sitecore.net/sitecore_experience_accelerator/setting_up_and_configuring/configuring/copy_and_customize_an_sxa_rendering

Or if you are not concerned about multisite and re-using the component, there is a faster way: just copy the Promo rendering item and adjust the fields you want (optionally the rendering parameters, surely the datasource and datatemplate as mentioned above)

This way you will end up with only one datasource. If you actually want three (for image, text and link separately) snippets are indeed the way to go - but normally your editors will like one datasource better..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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