Loading content based on domain
Hello Community - I am setting up the siteId based on the domain and would like to load different content specific to each domain.
<sly data-sly-test="${!wcmmode.edit}">
<script type="text/javascript">
if (location.hostname.indexOf("company") > -1) {
var siteId='company';
}
if (location.hostname.indexOf("aemcommunity") > -1) {
var siteId='aemcommunity';
}
</script>
</sly>
If it is a sightly expression, this can be used in data-sly-test but this is a javascript variable, how can I use it based on the condition. Could someone suggest on this?
<sly data-sly-test=""> -------> siteId='company'
<div>content loaded from company domain</div>
</sly>
<sly data-sly-test=""> -------> siteId='aemcommunity'
<div>content loaded from aemcommunity domain</div>
</sly>