Forum Discussion
The problem is that when the head gets rendered (where you rightfully would need the preloads etc.) we do not yet know if the page coming up will contain your component. So we cannot make that distinction. What you are effectively asking is: Can I modify the whole DOM from within a component on the server-side. It's an interesting thought, but this does not seem to be possible as the component is a self-contained element. It also conflicts with the Freemarker logic as that is that of a mere templating language.
What would be possible (to get everything into the component itself) is that you could have a parameter that you pass into your component and with that set, you only render the head/preload/.. tags. Then you can call your component from within the head_top component. At least that moves the logic out of there. What remains is to scope this only to the pages where this gets used - and THAT is not possible automatically, thus the component rendering call in the head_top would need to guarded by something like <#if page.name == FroumTopicPage> given you use your component there. That is the best we could do. We just do not know at that point in time if this is needed or not.
Related Content
- 4 years ago
- 13 years agoInactive User