There are two ways of linking between Hippo documents: 

  • Link in an html field
  • Link in a link picker or image picker (eg under ‘Related items’)

Link in link picker or image picker

A link to a hippo document, image or asset in a link or image picker is almost always defined as a sub-node of the document with the primary type hippo:mirror

A node that is defined with this type has a property hippo:docbase, which should contain the UUID of the Hippo document that it links to. 

The importer can resolve this link if the value of the hippo:docbase property of the hippo:mirror node is set to the Xillio id of the page, image or asset that it should link to.

Example

Let's say page2 should link to page1 in a block called ‘related items’.

Use the following content xml for page2:

<Resource name="page2" xillio_id="67890">
...
<Input name="page2" xillio_id="DD3C866A5985AF00CBE55BABB12710A9" 
type="mysite:nieuwsbericht">
...
<Input name="mysite:related" xillio_id="DD3C866A5985AF00CBE55BABB12710A9" 
type="hippo:mirror"> 
<Property name="hippo:docbase" resolve="true">
<Value><![CDATA[12345]]></Value>
</Property>
</Input>
...
</Input>
...
</Resource>

Note the resolve="true" attribute in the docbase block.

Example 2

If a page has a related decorative image, and you want to choose an image from the same import, you can also use the import id (in this case 'image_123') of the imported image and let it be resolved by the importer. The image block in the page xml could then look like this:

    <Input name="mysite:relateddecorativeimage" type="mysite:gallery:imagelink" xillio_id="67890_imageblock">
      <Property name="hippo:docbase" resolve="true" type="String">
        <Value><![CDATA[image_123]]></Value>
      </Property>
      <Property name="hippo:facets" multiple="true" type="String"/>
      <Property name="hippo:modes" multiple="true" type="String"/>
      <Property name="hippo:values" multiple="true" type="String"/>
    </Input>

Link in html field

This is one step more complicated, because the target id can not be filled in directly in the html. It has to go in a special 'facetselect' block, which is a subnode of a contentblock. A facetselect block is very similar to an image link block:

    <Input name="inlineID67890" type="hippo:facetselect" xillio_id="putUniqueNodeIDHere">
      <Property name="hippo:docbase" type="String" resolve="true">
        <Value><![CDATA[67890]]></Value>
      </Property>
      <Property name="hippo:facets" multiple="true" type="String"/>
      <Property name="hippo:modes" multiple="true" type="String"/>
      <Property name="hippo:values" multiple="true" type="String"/>
    </Input>

Links to other documents or images in the content block html field can then be resolved if the href or src attribute points to the name of the facetselect block, which would be 'inlineID67890' in this case. This name may also be the same as the id of the item itself.

Example

Imagine we have page1 with frontend url http://wwww.site.com/page1.html. This page has been assigned the xillio_id 12345. Let's say page2 should link to page1 in its content, as in <a href="http://www.site.com/page1.html">link to page1</a>. To import this internal link, the target url in the import xml of page2 should be replaced by an id of your choice, like <a href="inlineID12345">link to page1</a>. Then, a 'facetselect' block should be added to the contentblock, with the mentioned id as its name (inlineID12345) and the Xillio id of the linked item (12345) in the 'docbase' part of the facetselect. The importer will then fill in the target Hippo id of page1, which will then be shown on the target frontend with the correct url.

The import xml of this contentblock would look something like this:

<Input name="mysite:contentblock" type="mysitecontentblocks:textblock" xillio_id="putUniqueNodeIDHere">
  <Property name="mysitecontentblocks:title" type="string">
  <Value><![CDATA[Title]]></Value>
  </Property>
  <Input name="mysitecontentblocks:text" type="hippostd:html" xillio_id="putUniqueNodeIDHere">
  <Property name="hippostd:content" type="string">
    <Value><![CDATA[<p>Link example: <a href="inlineID12345">link to page1</a></p>]]></Value>
  </Property>
  <Input name="inlineID12345" type="hippo:facetselect" xillio_id="putUniqueNodeIDHere">
    <Property name="hippo:docbase" type="String" resolve="true">
      <Value><![CDATA[12345]]></Value>
    </Property>
    <Property name="hippo:facets" multiple="true" type="String"/>
    <Property name="hippo:modes" multiple="true" type="String"/>
    <Property name="hippo:values" multiple="true" type="String"/>
  </Input>
  </Input>
</Input>

Advanced options

There are a couple of bonus options for link resolution:

Resolve cms path instead of ID

Instead of using a Xillio import id to resolve internal links, you can use a target cms path, like /content/documents/mysite/news/2016/12/20. Note that a node name (in this case mainly the name of a facetselect block) may NOT contain the slash '/' character. The content block would in this case look something like this:

<Input name="mysite:contentblock" type="mysitecontentblocks:textblock" xillio_id="putUniqueNodeIDHere">
  <Property name="mysitecontentblocks:title" type="string">
  <Value><![CDATA[Title]]></Value>
  </Property>
  <Input name="mysitecontentblocks:text" type="hippostd:html" xillio_id="putUniqueNodeIDHere">
  <Property name="hippostd:content" type="string">
    <Value><![CDATA[<p>Link example: <a href="inlineID12345">link to page1</a></p>]]></Value>
  </Property>
  <Input name="inlineID12345" type="hippo:facetselect" xillio_id="putUniqueNodeIDHere">
    <Property name="hippo:docbase" type="String" resolve="true">
      <Value><![CDATA[/content/documents/mysite/news/2016/12/20]]></Value>
    </Property>
    <Property name="hippo:facets" multiple="true" type="String"/>
    <Property name="hippo:modes" multiple="true" type="String"/>
    <Property name="hippo:values" multiple="true" type="String"/>
  </Input>
  </Input>
</Input>

Links to specific image versions

Links to an image that belongs to an image set in Hippo, will by default resolve to the hippogallery:default image size. If you want a link to an image to resolve to a different image size, you can add the name of the image size to the xillio_id, as in 12345@project:w200h150.