Forum Discussion
I believe this has something to do with the way we implement <@delegate> internally combined with the way FreeMarker's block <#assign> works. Are you able to get around it by forcing a read, like <#assign dummyvariable = markup[0..]> ?
I had some other ideas for improvements:
- I'd recommend moving your <#if markup?contains("Recommendations")> as high as possible so that you don't do more work than necessary.
- Instead of using ?seq_contains, use our utils.sequence.unique(ids) utility method at the end.
- If you only intend to build ids so that you can iterate over it later, consider interleaving your "LOGIC" and "DISPLAY" loops so that you can space out some of your API calls.
- You don't need to escape a backslash in a regular expression string. ?matches("-p/(\\d+)") is fine.
Note that the DOM is not related here -- at the point this template is being processed, there is no HTML DOM. FreeMarker is maintaining its own data structure that represents the parsed template, and it is building pure text. Later on the other end of the wire, a browser will parse the text into a DOM.
Hi Andrew,
Thanks for the inputs.
I'm actually hiding the Recommendations OOB using their class through CSS.
My other issue is that the DISPLAY seems to be getting executed twice. Once *with* the IDs and once without it (chronologically). The "${markup?length}" if printed is around 11k and 1k in the cases. Which I find to be strange.
Which is why I'm having to use "<#if markup?contains("Recommendations")>"
😕
Related Content
- 4 years agoInactive User
- 6 months ago