You mean to set the two variables as properties on the node and then generate it? The reason why i didnt was because its not something that i want exposed or be editable
so as you seemingly don’t have any specific requirements for the ids I thought you could just use the node identifiers, as I assume those divs each represent a node. Node identifiers are unique, so nothing to worry about.
Something like id="anchor-{node.identifier}"
(and same for the href).
For performance reasons we lazily evaluate EEL expressions when used in the template. That is in your case of course a drawback and I just tried several variants but there is no good way to work around this.