slingsightlyhtl

How can one access a resource via node UUID in Sightly/HTL?


As of HTL 1.4, it is possible to access a resource if you know its path by using data-sly-use, e.g.: data-sly-use.item="/content/my_nodes/node1"

However, if one does not have the path to the resource, but only the node's jcr:uuid (automatically generated through use of mix:referenceable), is there any way that one can look up the resource with a similar HTL statement?


Solution

  • There is no such convenience, at the moment. However, the HTL specification does not exclude this and you should be able to write your own UseProvider implementation. You can have a look at the ResourceUseProvider for inspiration.