Dynamic header title component issue with multiple websites on the same platform



HI I'm using AEM 6.3 Editable templates.

I have created a custom Template A.

Site1,Site2,Site3,Site4 are built using Template A and I have header title component on each site which should be unique per site, PFB screenshots for the reference.

we need help to build this title component dynamic for multiple websites, so that the title is dynamically picking from the title of the root page.



Accepted Solutions (1)

Accepted Solutions (1)

Answers (3)

Answers (3)




Please open a new thread for this question; this thread has been marked as answered, thus it's less likely that people are looking into this post. I would not have checked this thread if you had not pinged me directly 🙂

Regarding to your question: you can package and deploy them. But as these values are supposed to change during runtime you should not include it into regular deployment. And one of the most relevant aspects is that it should be optional. If authors decide to change some default value, they will create the new value in /conf (e.g using the CA configuration editor).



Hi Tim,

I have implemented dynamic title component using Context Aware Configuration.

I have followed Jörg Hoh​  blog Sling Context-Aware configuration (part 2) | Things on a content management system

1.Is there any way to automate the creating nodes on conf location?

2.same way i have implemented dynamic navigation component in editable templates, here i am facing issue.

It is always taking default path.Navigation component not taking latest page path. I can see latest path in my in my logs.

Here is my code


@Configuration(label = "Navigation Root Context Aware Config")

public @interface NavigationRootCAConfig {

   @Property(label = "Navigation Root")

  String navigationRoot() default "/content/site1/en";


@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)

public class LeftNav {

   protected final Logger logger = LoggerFactory.getLogger(LeftNav.class);

   private String DEFAULT_NAV_ROOT = "/content/site1/en";

   private List<Page> navItems = new ArrayList<>();

   private Page currentPage;

   private String navigationRoot;

   private boolean collectAllPages;

   private int structureDepth;


  Resource resource;

   ResourceResolver resourceResolver;

   ComponentService componentService;

   protected void init() {

   logger.info("Nav Root Path : " + navigationRoot);

   logger.info("Collect All Pages : " + collectAllPages);

   logger.info("Structure Depth : " + structureDepth);

   if (StringUtils.isBlank(navigationRoot)) {

   navigationRoot = getNavigationRoot();

   logger.info("Navigation root {} .....", navigationRoot);

   navItems.addAll(componentService.getNavItems(navigationRoot, collectAllPages, structureDepth));



   public List<Page> getNavItems() {

   return navItems;


   public String getNavigationRoot() {

   currentPage = resourceResolver.adaptTo(PageManager.class).getContainingPage(resource);

  String path = currentPage != null ? currentPage.getPath() : "";

   if (!StringUtils.isBlank(path) && resource != null) {

   NavigationRootCAConfig navRootCAConfig = resource.adaptTo(ConfigurationBuilder.class).as(NavigationRootCAConfig.class);

   logger.info("Navigation root path {} *** ", navRootCAConfig.navigationRoot());

   navigationRoot = navRootCAConfig.navigationRoot();

  } else {

   navigationRoot = DEFAULT_NAV_ROOT;


   return navigationRoot;


   public void setNavigationRoot(String navigationRoot) {

   this.navigationRoot = navigationRoot;


   public boolean isCollectAllPages() {

   return collectAllPages;


   public void setCollectAllPages(boolean collectAllPages) {

   this.collectAllPages = collectAllPages;


   public int getStructureDepth() {

   return structureDepth;


   public void setStructureDepth(int structureDepth) {

   this.structureDepth = structureDepth;


   public Page getCurrentPage() {

   return componentService.getCurrentPage(navigationRoot, collectAllPages, structureDepth);


   public void setCurrentPage(Page currentPage) {

   this.currentPage = currentPage;


   public void setNavItems(List<Page> navItems) {

   this.navItems = navItems;


Can anyone help here?





Team replied:

Seems like the simpler approach is to just manage it as structure title component – I cant imagine the site name changes often.

If core componets don’t support this- you’d need a new component.