One of my earlier blogs talked about how to reuse the same editable templates with multiple sites, how to use the XF localization feature to enable different headers and footers for the websites build on the same template — there are multiple approaches to achieve this e.g. dedicated template for sites, enabling the header at page level rather in template level but we enabled the header in template level and used the localization feature to support the header variants.
Refer to the following URL for more details — How To Reuse Editable Template With Multiple Sites — Adobe Experience Manager(AEM)?
The XF localization feature works well if the content(/content/mysite1/us/en) and experience fragment(/content/experience-fragments/mysite1/us/en) structures follows the same pattern.
Recently we had a use case to reuse the pages created with editable template under the legacy content path with localized headers/footers(independent websites) — as I said earlier this can be achieved in multiple ways e.g. create a dedicated template but we decided to extend the Experience Fragment localization logic with delegation pattern.
The global header XF is enabled under — /content/experience-fragments/mysite1/us/en/site/header/master and the content is under /content/mysite1/us/en — the header XF is embeded in the template structure, this supports localization by just enabling the copy of header XF and the content(e.g. XF — /content/experience-fragments/mysite1/fr/fr/site/header/master, Site — /content/mysite1/fr/fr). The need is to reuse the same content under(with same template) the legacy content path(e.g /content/mysite2/en-US), the default XF localization feature will not help here to enable the localized header for the pages under /content/mysite2/en-US as the the legacy content path structure is not matching with the global header embeded in the template.