Search code examples
javascriptangularspartacus-storefront

Customize multiple banner components separately in Spartacus


I have multiple bannercomponents in my home page and need to customise each one independently. I understand I can use ConfigModule.withConfig to replace the bannercomponent with a customcomponent but that will replace all bannercomponents with the same customcomponent. Is there a way to replace each of the bannercomponents separately?


Solution

  • Please define custom banner components in backoffice/sampledata based on the original one, then just add cms mapping in your Spartacus for each one separately:

         cmsComponents: {
           BannerComponent: {
              component: YourBannerComponent,
           },
           YourOtherBannerComponent: {
              component: YourOtherBannerComponent,
           },
         },