Here is the simple structure
Site A:
- CT_1_Item1
– slotA
—CT_2_Item1
Site B:
- CT_3_Item1
–slotB
— CT_1_Item1
What I want to do is to generate a valid url to CT_2_Item1 from Site B on the full page template of CT_3_Item1. I am doing this on a velocity macro on CT_3’s full page template. Everything is almost working, except it thinks that CT_2_Item1 is on Site B. The link to CT_1_Item1 is however correct.
After some trial and error, i realized that the when setting the node after $sys.assemblyItem.clone(), the cloned assemblyItem does NOT have the correct siteid set.
A simple test with a cross site link confirmed this:
initslot("mySlot" "")
#if($sys.currentslot.relresults.size() > 0)
#set($relresult = $sys.currentslot.relresults.get(0))
#set($test = $sys.assemblyItem.clone())
$test.setNode($relresult.getNode())##
$relresult.getSiteId()
$test.getSiteId()
#end## $sys.currentslot
#endslot("mySlot")
I expected $relresult.getSiteId() to equal $test.getSiteId() but that is not the case. Is this the correct behavior or is it a bug? I would have assumed that when you set the node, that the site id would also be set to that node’s site id (ie it could be one of the property values of the node), but clearly I am mistaken.
BTW, I can get around my problem by passing the $relresult around my macros to generate the correct url, but I just thought that the above was an unexpected behavior.