You don't need to use any patch:delete
or patch:instead
. You just need to add name
attribute to your new <site>
tags so Sitecore will treat them as a separate site definitions.
Here is some further explanation: Config patching system for the external config files
Create App_config\Include\My.Site.Definition.config
file with content:
<sitecore>
<sites>
<site name="mysite" patch:before="site[@name='website']"
... />
</sites>
<events>
<event name="publish:end">
<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
<sites hint="list">
<site name="mysite">mysite</site>
</sites>
</handler>
</event>
<event name="publish:end:remote">
<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
<sites hint="list">
<site name="mysite">mysite</site>
</sites>
</handler>
</event>
</events>
</sitecore>
The other option would be to use some other tags instead of <site>
tag, cause when the parent tag contains hint="list"
attribute, it treats all the children tags as items for that list. You would need to make sure that every tag is unique. You can use it like that:
<event name="publish:end:remote">
<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
<sites hint="list">
<site1>mysite</site1>
<othersite>othersite</othersite>
</sites>
</handler>
</event>