How to make experience fragment variations in page templates language-aware and site-aware (agnostic)?
Assume I have the following setup:
Two sites with both english and french content pages
/content/siteAAA/language-masters/en
/content/siteAAA/language-masters/fr
/content/siteBBB/language-masters/en
/content/siteBBB/language-masters/fr
Site AAA was created first and all my page templates are defined in its conf folder. E.g.
/conf/siteAAA/settings/wcm/templates/best-product
Now I also want to use the exact same page templates for Site BBB
First challenge: how to make the variation language-aware
In my "best-product" page template, I have configured two experience fragments, one for the header and one for the footer. The path to include this from the page template is pointing to the english version
/content/experience-fragments/siteAAA/language_masters/en/site/header/master
Now, both english and french pages using this best-product page template show only the english header XF
/content/siteAAA/language-masters/en/buy-this
/content/siteAAA/language-masters/fr/buy-this
But maybe I want a different header on my french pages, so I want the page template and experience fragment to be language-context-aware, and use the FR sibling in the experience-fragments folder.
How can this be achieved? Obviously I do not want to create a copy of all page templates for every language, to point to their own hardcoded experience fragment path.
Second challenge: how to also make the variation site-aware
Now since I have another site also using the same page templates, I want the path to include the experience fragment variation to be site-aware as well as language aware
In other words, I only have ONE generic page template with only ONE header experience fragment configured, and
Page /content/siteAAA/language-masters/en/buy-this
Uses XF /content/experience-fragments/siteAAA/language_masters/en/site/header/master
Page /content/siteAAA/language-masters/fr/buy-this
Uses XF /content/experience-fragments/siteAAA/language_masters/fr/site/header/master
Page /content/siteBBB/language-masters/en/buy-this
Uses XF /content/experience-fragments/siteBBB/language_masters/en/site/header/master
Page /content/siteBBB/language-masters/fr/buy-this
Uses XF /content/experience-fragments/siteBBB/language_masters/fr/site/header/master
How can this be achieved?