In the Visualforce page context, we have the $Site.Prefix
formula available to get the community's path prefix so we can adapt our link for the internal users.
I'm wondering if something similar can be achieved on Visualforce Email Templates. For example, if I have a community user that should get an automated email with a link for a record. The link must be company.force.com/community/<record_id>
instead of company.my.salesforce.com/<record_id>
for internal users. Is it possible to dynamically detect the users's community?