Adding template hooks in core rather than overriding templates in plugin

I would like to know what is your position regarding adding template_hooks in indico-core templates whenever possible, rather than overriding templates. The rationale for this is to prevent divergencies between plugin-overridden templates and core templates as they evolve over time.

I’m anticipating that much of the maintenance efforts of the plugin will end up being directed at keeping plugin-overridden templates up-to-date with the changes introduced in their corresponding core templates. For that reason, I believe a saner approach would be to avoid overriding templates as much as possible. Whenever the plugin needs to add stuff, we would try to do so via template_hook.

The drawback with this approach is that we would need coordination with indico-core maintainers for every template_hook we want to add, which may slow us down significantly in the short term. At the same time, having more template_hooks introduce no penalty and it makes Indico more easily extensible for all plugin developers, so maybe we can go ahead without double checking with you before hand for every single template_hook we need.

An ideal strategy for us would be:

  • Whenever we need the plugin to add stuff, we introduce a new template_hook in our fork of Indico.
  • Every now and then, we contribute a batch of newly added hooks upstream via PR.
  • In the review process, some hooks may change name, move to a different location, or just be dismissed.
  • Once the PR is merged, we update our fork and adapt the plugin to reflect these changes, overriding templates only then if necessary.

Would this work for you? Happy to hear alternatives to handle this.

1 Like

I think whenever you can find a name for the hook that makes sense to others, then it’s a very good idea! (“unog-before-whatver” wouldn’t be ok in the core obviously, but “before-category-menu” would)

A PR adding a bunch of template hooks in one go sounds like a good idea for sure!


Adding template hooks whenever we needed them is basically what we did with the ones we have right now in the core - and that was always the idea: If someone wants to do something where a template hook is useful, contribute the hook and then use it in a plugin.