As Experro allows the creation of multiple Channels for a workspace, you can create a template for a specific Channel and assign it to that Channel only. This template will be available exclusively for that particular Channel and will not be accessible in other channels. For information on how templates work in Experro, you can refer to Default-Templates and Custom-Templates. To create channel-specific templates, follow these steps:
  1. Create a normal <template_name>.tsx file under the src/templates folder.
  2. Register that template in the src/templates/templates.ts file. Here, you will see other templates being imported and exported.
This is the initial step for creating templates specific to a channel in Experro, just as simple as you’ve seen for Custom-Templates. The next step is crucial for creating a channel-specific template. Open the template-list.ts file, which looks like this:
const getTemplates = (templates: any) => {
  const experroTemplateMap = {
    'default': { // Default channels Templates
      // ...existing templates
      'FAQ Template': {
        component: templates['FAQPage'],
        displayName: 'FAQs',
      },
      'Product Details Default': {
        component: templates['ProductDetailsExp1'],
        displayName: 'Product Details Default',
      }
    }
  };
};
Here, we have an object experroTemplateMap:
const experroTemplateMap = {
  'default': { // Default channels Templates
    // ...existing templates
    'FAQ Template': {
      component: templates['FAQPage'],
      displayName: 'FAQs',
    },
    'Product Details Default': {
      component: templates['ProductDetailsExp1'],
      displayName: 'Product Details Default',
    }
  }
};
In that object, the first key default indicates that all the templates registered under this default key will be available by default for the Default Channel and all other channels. This will remain the case until we provide any channel-specific templates.
To create a channel-specific template, you need to have the channel ID, which you can get from Channel Details. Just copy it and create a new object key for experroTemplateMap.
For example, if you want to create a specific Product Details template for a second channel, different from the default channel, follow these steps:
  1. Create a <template_name>.tsx file for the new template.
  2. Update the experroTemplateMap to include a new key for the channel ID.
Ensure that each channel-specific template has a unique display name.
Here’s how your updated experroTemplateMap will look:
const experroTemplateMap = {
  'default': { // Default channel templates
    // ...existing templates
    'Product Details Default': {
      component: templates['ProductDetailsExp1'],
      displayName: 'Product Details Default',
    }
  },
  'ad7e9f63-6532-4e2a-9adf-fb312a635ffe': { // Channel-specific templates
    'Product Details Exp 2': {
      component: templates['ProductDetailsExp2'],
      displayName: 'Product Details Exp 2',
    }
  }
}
In this example, the default Product Details template is available for the default channel, while the Product Details Exp 2 template is specific to the channel with ID ad7e9f63-6532-4e2a-9adf-fb312a635ffe. So, For the channel with ID ad7e9f63-6532-4e2a-9adf-fb312a635ffe, Experro will load the Product Details Exp 2 template instead of the default Product Details Default template. This allows you to have channel-specific templates while falling back to the default templates for other channels. That’s only few steps need to perform to create a Channel specific templates.