Skip to main content
Level 3
May 25, 2026
Question

Best approach to restrict Experience Fragment components per template in AEM

  • May 25, 2026
  • 2 replies
  • 19 views

We have a requirement involving seven different templates in AEM. For each template, we want to allow the Experience Fragment component, but with a restriction: the Experience Fragment should only allow the components that are specifically permitted for that template.

In other words, each template has its own set of allowed components, and the Experience Fragment should enforce those rules so that authors cannot add components outside the template’s defined scope.

We would like to understand:

  • What is the best possible solution to achieve this scenario?

  • Are there recommended practices or configurations in AEM to enforce template-specific component restrictions within Experience Fragments?

Any guidance or examples from the community on how to implement this in a scalable and maintainable way would be greatly appreciated.

2 replies

Adobe Employee
May 25, 2026

@S__k__Agarwal 

The best AEM-native solution is to control allowed components at the Experience Fragment template/content-policy level, not at the page template that consumes the XF.

If your requirement is:

  • Template A pages can use XFs containing only components A1, A2, A3
  • Template B pages can use XFs containing only components B1, B2
  • ...and so on for seven templates

then the scalable pattern is to create seven XF authoring models—typically seven XF templates or seven distinct XF content policies—and map each one to the matching page-template use case. AEM's supported control point for "what components can exist inside an XF" is the XF's own editable template/content policy. It is not the consuming page's template. 
Experience Fragments Overview 
Experience Fragments in Adobe Experience Manager Sites development
Templates to Create Pages that are Editable with the Page Editor

Level 4
May 25, 2026

Hi ​@S__k__Agarwal,


 

Great answer from ​@SubbaraoGa1 to add the practical implementation detail on how to set this up:

 

For each of your 7 templates, here is the exact steps:

1. Go to Tools > General > Templates
2. Create or open each XF-specific template
3. In the template editor, go to the layout container policy
4. Under "Allowed Components" configure only the components permitted for that XF template
5. Save the policy

 

Then when authors create an XF, they select the appropriate XF template and are automatically restricted to only those allowed components.

 

To keep it maintainable at scale:
- Name your XF templates clearly to match their consuming page template e.g. "Header XF - Template A", "Hero XF - Template B"
- Use Component Groups in your allowed components config rather than individual components this way adding a new component to a group automatically propagates to all policies using that group
- Store all XF templates under a dedicated folder: /conf/<your-project>/settings/wcm/templates/xf/

 

This gives you clean governance across all 7 templates without any custom code needed.