In our Sitecore 9 setup we are using a CD and CM server.
Currently, we have these config transformations:
<sites env:require="TestCM" xdt:Transform="Insert">
<site name="website">
<patch:attribute name="targetHostName">tst-cms-customer.domain.com</patch:attribute>
<patch:attribute name="hostName">tst-cms-customer.domain.com</patch:attribute>
</site>
</sites>
<sites env:require="TestCD" xdt:Transform="Insert">
<site name="website">
<patch:attribute name="targetHostName">tst-customer.domain.com</patch:attribute>
<patch:attribute name="hostName">tst-customer.domain.com</patch:attribute>
</site>
</sites>
which ensures that the enduser can reach the website using tst-customer.domain.com
, while the Sitecore editor login using tst-cms-customer.domain.com
(notice the cms
part).
Now, we have a custom command, which creates urls to pages using this code:
LinkField lf = item.Fields[fieldId];
var options = LinkManager.GetDefaultUrlOptions();
options.AlwaysIncludeServerUrl = true;
options.SiteResolving = true;
return lf.TargetItem == null ? string.Empty : LinkManager.GetItemUrl(lf.TargetItem, options);
The urls are stored in a file.
All the urls created using this command, contains this: tst-cms-customer.domain.com
.
We want the urls to contain the url to the enduser site, i.e. tst-customer.domain.com
.
Do we need to change the targethostname (for the CM) to be tst-customer.domain.com
? Or how do we accomplish this?